<?php
/**
 * @copyright  Vertex. All rights reserved.  https://www.vertexinc.com/
 * @author     Mediotype                     https://www.mediotype.com/
 */

/** @var $block Vertex\Tax\Block\Customer\Widget\TaxCountry */
?>
<div class="field taxvat-country">
    <label class="label" for="taxvat-country"><span><?= $block->escapeHtml(__('Country')) ?></span></label>
    <select name="extension_attributes[vertex_customer_country]"
        id="taxvat-country" data-validate="{'vertex-customer-country':'#taxvat'}">
        <?php foreach ($block->getCountryOptions() as $option): ?>
            <option value="<?= $block->escapeHtml($option['value']) ?>"
                <?= $block->getTaxCountry() && $block->getTaxCountry() == $option['value'] ? 'selected' : '' ?>>
                <?= $block->escapeHtml($option['label']) ?>
            </option>
        <?php endforeach; ?>
    </select>
</div>
<script type="text/x-magento-init">
    {
        "#taxvat-country": {
            "Vertex_Tax/js/model/customer-country-validation": {}
        }
    }
</script>
