<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_product_deliverability_form %}
<div class="product-deliverability-form">
    <sw-container
        columns="1fr 1fr 1fr"
        gap="0px 30px"
    >
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_product_deliverability_form_stock_field %}
        <sw-number-field
            v-model:value="product.stock"
            name="sw-field--product-stock"
            number-type="int"
            :disabled="!allowEdit"
            :label="$tc('sw-product.settingsForm.labelStock')"
            :placeholder="$tc('sw-product.settingsForm.placeholderStock')"
            :error="productStockError"
        />
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_product_deliverability_form_available_stock_field %}
        <sw-number-field
            v-model:value="product.availableStock"
            name="sw-field--product-available-stock"
            number-type="int"
            :disabled="true"
            :label="$tc('sw-product.settingsForm.labelAvailableStock')"
        />
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_product_deliverability_form_is_closeout_field %}
        <sw-inherit-wrapper
            v-model:value="product.isCloseout"
            :has-parent="!!parentProduct.id"
            :inherited-value="parentProduct.isCloseout"
        >
            <template #content="props">

                <sw-switch-field
                    name="sw-field--product-is-closeout"
                    :error="productIsCloseoutError"
                    :map-inheritance="props"
                    :label="$tc('sw-product.settingsForm.labelIsCloseout')"
                    :help-text="$tc('sw-product.settingsForm.isCloseoutHelpText')"
                    :disabled="props.isInherited || !allowEdit"
                    :value="props.currentValue"
                    @update:value="props.updateCurrentValue"
                />

            </template>
        </sw-inherit-wrapper>
        {% endblock %}
    </sw-container>

    <sw-container
        columns="1fr 1fr 1fr"
        gap="0px 30px"
    >
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_product_deliverability_form_delivery_time_field %}
        <sw-inherit-wrapper
            v-if="showModeSetting"
            v-model:value="product.deliveryTimeId"
            :inherited-value="parentProduct.deliveryTimeId"
            :has-parent="!!parentProduct.id"
            :label="$tc('sw-product.settingsForm.labelDeliveryTime')"
        >
            <template #content="{ currentValue, updateCurrentValue, isInherited }">

                <sw-entity-single-select
                    id="deliveryTimeId"
                    :key="isInherited"
                    :value="currentValue"
                    entity="delivery_time"
                    :disabled="isInherited || !allowEdit"
                    class="product-deliverability-form__delivery-time"
                    :error="productDeliveryTimeIdError"
                    :placeholder="$tc('sw-product.settingsForm.placeholderDeliveryTime')"
                    show-clearable-button
                    @update:value="updateCurrentValue"
                />
            </template>
        </sw-inherit-wrapper>
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_product_deliverability_form_restock_field %}
        <sw-inherit-wrapper
            v-if="showModeSetting"
            v-model:value="product.restockTime"
            class="sw-product-deliverability__restock-field"
            :has-parent="!!parentProduct.id"
            :inherited-value="parentProduct.restockTime"
        >
            <template #content="props">

                <sw-number-field
                    name="sw-field--product-restock-time"
                    :map-inheritance="props"
                    number-type="int"
                    allow-empty
                    :min="0"
                    :disabled="props.isInherited || !allowEdit"
                    :label="$tc('sw-product.settingsForm.labelRestockTime')"
                    :placeholder="$tc('sw-product.settingsForm.placeholderRestockTime')"
                    :value="props.currentValue"
                    :error="productRestockTimeError"
                    @update:value="props.updateCurrentValue"
                />

            </template>
        </sw-inherit-wrapper>
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_product_deliverability_form_shipping_free_field %}
        <sw-inherit-wrapper
            v-if="showModeSetting"
            v-model:value="product.shippingFree"
            class="sw-product-deliverability__shipping-free"
            :has-parent="!!parentProduct.id"
            :inherited-value="parentProduct.shippingFree"
        >
            <template #content="props">

                <sw-switch-field
                    :map-inheritance="props"
                    :error="productShippingFreeError"
                    :label="$tc('sw-product.settingsForm.labelShippingFree')"
                    :disabled="props.isInherited || !allowEdit"
                    :value="props.currentValue"
                    @update:value="props.updateCurrentValue"
                />

            </template>
        </sw-inherit-wrapper>
        {% endblock %}
    </sw-container>

    <sw-container
        columns="1fr 1fr 1fr"
        gap="0px 30px"
    >
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_product_deliverability_form_min_purchase_field %}
        <sw-inherit-wrapper
            v-if="showModeSetting"
            v-model:value="product.minPurchase"
            class="sw-product-deliverability__min-purchase"
            :has-parent="!!parentProduct.id"
            :inherited-value="parentProduct.minPurchase"
        >
            <template #content="props">

                <sw-number-field
                    :map-inheritance="props"
                    number-type="int"
                    :min="1"
                    :error="productMinPurchaseError"
                    :label="$tc('sw-product.settingsForm.labelMinPurchase')"
                    :placeholder="$tc('sw-product.settingsForm.placeholderMinPurchase')"
                    :disabled="props.isInherited || !allowEdit"
                    :value="props.currentValue"
                    @update:value="props.updateCurrentValue"
                />

            </template>
        </sw-inherit-wrapper>
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_product_deliverability_form_purchase_steps_field %}
        <sw-inherit-wrapper
            v-if="showModeSetting"
            v-model:value="product.purchaseSteps"
            class="sw-product-deliverability__purchase-step"
            :has-parent="!!parentProduct.id"
            :inherited-value="parentProduct.purchaseSteps"
        >
            <template #content="props">

                <sw-number-field
                    :map-inheritance="props"
                    number-type="int"
                    :min="1"
                    :error="productPurchaseStepsError"
                    :label="$tc('sw-product.settingsForm.labelPurchaseSteps')"
                    :placeholder="$tc('sw-product.settingsForm.placeholderPurchaseSteps')"
                    :disabled="props.isInherited || !allowEdit"
                    :value="props.currentValue"
                    @update:value="props.updateCurrentValue"
                />
            </template>
        </sw-inherit-wrapper>
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_product_deliverability_form_max_purchase_field %}
        <sw-inherit-wrapper
            v-if="showModeSetting"
            v-model:value="product.maxPurchase"
            class="sw-product-deliverability__max-purchase"
            :has-parent="!!parentProduct.id"
            :inherited-value="parentProduct.maxPurchase"
        >
            <template #content="props">

                <sw-number-field
                    :map-inheritance="props"
                    number-type="int"
                    :allow-empty="true"
                    :min="0"
                    :error="productMaxPurchaseError"
                    :label="$tc('sw-product.settingsForm.labelMaxPurchase')"
                    :placeholder="$tc('sw-product.settingsForm.placeholderMaxPurchase')"
                    :disabled="props.isInherited || !allowEdit"
                    :value="props.currentValue"
                    @update:value="props.updateCurrentValue"
                />
            </template>
        </sw-inherit-wrapper>
        {% endblock %}
    </sw-container>
</div>
{% endblock %}
