<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var \Magento\Customer\Block\Widget\Telephone $block */
?>
<div class="field telephone <?= $block->isRequired() ? 'required' : '' ?>">
    <label for="telephone" class="label">
        <span>
            <?= $block->escapeHtml(__('Phone Number')) ?>
        </span>
    </label>
    <div class="control">
            <?php
            $_validationClass = $block->escapeHtmlAttr(
                $this->helper(\Magento\Customer\Helper\Address::class)
                     ->getAttributeValidationClass('telephone')
            );
            ?>
        <input type="text"
               name="telephone"
               id="telephone"
               value="<?= $block->escapeHtmlAttr($block->getTelephone()) ?>"
               title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>"
               class="input-text <?= $_validationClass ?: '' ?>"
               data-afd-control="phone"
               data-afd-additional-options="afdPhoneOptions"
        >
        <div class="afd-error field-error">
            <span></span>
        </div>
    </div>
</div>
<script type="text/javascript">
    require(['jquery', 'afdPce', 'domReady!app/Afd/Pce/view/base/templates/afd_options'], function ($) {
        $('#telephone')
            .afd('phone')
            .siblings('.afd-error')
            .find('span')
            .text(afdOptions.magentoOptions.phone.invalidMessage);

    })
</script>
