<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_settings_country_general %}
<div>
    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_settings_country_general_card %}
    <sw-card
        position-identifier="sw-settings-country-detail-general"
        :title="$tc('sw-settings-country.detail.titleCard')"
        :is-loading="isLoading"
    >
        <sw-container
            columns="repeat(auto-fit, minmax(250px, 1fr))"
            gap="0px 30px"
        >

            <!-- eslint-disable sw-deprecation-rules/no-twigjs-blocks, vue/attributes-order -->
            {% block sw_settings_country_general_content_field_name %}
            <sw-text-field
                v-model:value="country.name"
                name="sw-field--country-name"
                required
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelName')"
                :placeholder="placeholder(country, 'name', $tc('sw-settings-country.detail.placeholderName'))"
                :error="countryNameError"
            />
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_position %}
            <sw-number-field
                v-model:value="country.position"
                name="sw-field--country-position"
                number-type="int"
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelPosition')"
                :placeholder="placeholder(country, 'position', $tc('sw-settings-country.detail.placeholderPosition'))"
            />
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_iso %}
            <sw-text-field
                v-model:value="country.iso"
                name="sw-field--country-iso"
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelIso')"
                :placeholder="placeholder(country, 'iso', $tc('sw-settings-country.detail.placeholderIso'))"
            />
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_iso3 %}
            <sw-text-field
                v-model:value="country.iso3"
                name="sw-field--country-iso3"
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelIso3')"
                :placeholder="placeholder(country, 'iso3', $tc('sw-settings-country.detail.placeholderIso3'))"
            />
            {% endblock %}
        </sw-container>
    </sw-card>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_settings_country_general_options_card %}
    <sw-card
        position-identifier="sw-settings-country-general"
        :title="$tc('sw-settings-country.detail.titleOptions')"
        :is-loading="isLoading"
    >
        <sw-container class="sw-settings-country-general__options-container">

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_active %}
            <sw-switch-field
                v-model:value="country.active"
                name="sw-field--country-active"
                class="sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelActive')"
            />
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_shipping_available %}
            <sw-switch-field
                v-model:value="country.shippingAvailable"
                name="sw-field--country-shippingAvailable"
                class="sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelShippingAvailable')"
            />
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_tax_free %}
            <sw-switch-field
                v-model:value="country.customerTax.enabled"
                name="sw-field--country-customerTax-enabled"
                class="sw-settings-country-general__option-items switch-field-customer-tax-free"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelTaxFree')"
            />
            {% endblock %}

            <sw-container
                v-if="country.customerTax.enabled"
                class="sw-settings-country-general-customer-tax"
            >

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_settings_country_general_content_field_tax_free_from_customer %}
                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_settings_country_general_content_field_tax_free_from_customer_value %}
                <sw-number-field
                    v-model:value="country.customerTax.amount"
                    name="sw-field--country-customerTax-amount"
                    class="sw-settings-country-general__input-amount customer-tax-amount"
                    :min="0"
                    :label="$tc('sw-settings-country.detail.taxFreeFrom')"
                    :help-text="$tc('sw-settings-country.detail.taxFreeFromHelpText')"
                    :disabled="!acl.can('country.editor') || undefined"
                >
                    <template #suffix>
                        <sw-entity-single-select
                            v-model:value="country.customerTax.currencyId"
                            name="sw-field--country-customerTax-currencyId"
                            class="sw-settings-country-general__customer-select-currency sw-settings-country-general__select"
                            entity="currency"
                            bordered
                            show-clearable-button
                            :disabled="!acl.can('country.editor') || undefined"
                        />
                    </template>
                </sw-number-field>
                {% endblock %}
                {% endblock %}

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_settings_country_general_content_show_tax_free_currency_dependent_values %}
                <sw-container
                    columns="1fr"
                    justify="end"
                >
                    <a
                        class="sw-settings-country-general__currency-dependent-modal"
                        role="button"
                        tabindex="0"
                        @click="openCustomerTaxModal"
                        @keydown.enter="openCustomerTaxModal"
                    >
                        {{ $tc('sw-settings-country.detail.currencyDependentValues') }}
                        <sw-icon
                            name="regular-long-arrow-right"
                            small
                        />
                    </a>
                </sw-container>
                {% endblock %}

            </sw-container>

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_tax_free_companies %}
            <sw-switch-field
                v-model:value="country.companyTax.enabled"
                name="sw-field--country-companyTax-enabled"
                class="sw-settings-country-general__option-items switch-field-company-tax-free"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelCompanyTaxFree')"
                :help-text="$tc('sw-settings-country.detail.helpTextCompanyTaxFree')"
            />
            {% endblock %}

            <sw-container
                v-if="country.companyTax.enabled"
                class="sw-settings-country-general-company-tax"
            >

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_settings_country_general_content_field_tax_free_from_companies %}
                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_settings_country_general_content_field_tax_free_from_companies_value %}
                <sw-number-field
                    v-model:value="country.companyTax.amount"
                    name="sw-field--country-companyTax-amount"
                    class="sw-settings-country-general__input-amount"
                    :min="0"
                    :label="$tc('sw-settings-country.detail.taxFreeFrom')"
                    :help-text="$tc('sw-settings-country.detail.taxFreeFromHelpText')"
                    :disabled="!acl.can('country.editor') || undefined"
                >
                    <template #suffix>
                        <sw-entity-single-select
                            v-model:value="country.companyTax.currencyId"
                            name="sw-field--country-companyTax-currencyId"
                            class="sw-settings-country-general__company-select-currency sw-settings-country-general__select"
                            entity="currency"
                            show-clearable-button
                            :disabled="!acl.can('country.editor') || undefined"
                        />
                    </template>
                </sw-number-field>
                {% endblock %}
                {% endblock %}

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_settings_country_general_content_show_company_tax_free_currency_dependent_values %}
                <sw-container
                    columns="1fr"
                    justify="end"
                >
                    <a
                        class="sw-settings-country-general__currency-dependent-modal"
                        role="button"
                        tabindex="0"
                        @click="openCompanyTaxModal"
                        @keydown.enter="openCompanyTaxModal"
                    >
                        {{ $tc('sw-settings-country.detail.currencyDependentValues') }}
                        <sw-icon
                            name="regular-long-arrow-right"
                            small
                        />
                    </a>
                </sw-container>
                {% endblock %}
            </sw-container>

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_show_currency_dependent_modal %}
            <sw-settings-country-currency-dependent-modal
                v-if="showCurrencyModal"
                :currency-depends-value="currencyDependsValue"
                :country-id="countryId"
                :is-loading="isLoading"
                :menu-options="menuOptions"
                :user-config="userConfig"
                :user-config-values="userConfigValues"
                :tax-free-type="taxFreeType"
                @modal-close="onToggleCurrencyModal"
                @modal-save="saveCountryCurrencyDependent"
                @base-item-change="changeBaseItem"
            />
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_check_vat_id_format %}
            <sw-switch-field
                v-model:value="country.checkVatIdPattern"
                name="sw-field--country-checkVatIdPattern"
                class="sw-settings-country-general__field-check-vatid-format sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelCheckVatIdFormat')"
                :help-text="$tc('sw-settings-country.detail.helpTextCheckVatIdFormat')"
            />
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_vat_id_required %}
            <sw-switch-field
                v-model:value="country.vatIdRequired"
                name="sw-field--country-vatIdRequired"
                class="sw-settings-country-general__vat-id-required sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelVatIdRequired')"
                :help-text="$tc('sw-settings-country.detail.helpTextLabelVatIdRequired')"
            />
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_country_general_content_field_is_eu %}
            <sw-switch-field
                v-model:value="country.isEu"
                name="sw-field--country-isEu"
                class="sw-settings-country-general__is-eu sw-settings-country-general__option-items"
                bordered
                :disabled="!acl.can('country.editor') || undefined"
                :label="$tc('sw-settings-country.detail.labelIsEu')"
            />
            {% endblock %}
        </sw-container>
    </sw-card>
    {% endblock %}

</div>
{% endblock %}
