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

// @codingStandardsIgnoreFile
/* @var $block \Magento\Paypal\Block\Payment\Form\Billing\Agreement */
?>
<?php $code = $block->escapeHtml($block->getMethodCode()) ?>
<fieldset class="admin__fieldset payment-method form-list"
          id="payment_form_<?= /* @noEscape */ $code ?>" style="display:none;">
    <div class="admin__field _required">
        <label class="admin__field-label"
               for="<?= /* @noEscape */ $code ?>_ba_agreement_id">
            <span><?= $block->escapeHtml(__('Billing Agreement')) ?></span>
        </label>
        <div class="admin__field-control">
            <select id="<?= /* @noEscape */ $code ?>_ba_agreement_id"
                    name="payment[<?= $block->escapeHtml($block->getTransportName()) ?>]"
                    class="required-entry admin__control-select">
                <option value=""><?= $block->escapeHtml(__('Please Select')) ?></option>
                <?php foreach ($block->getBillingAgreements() as $id => $referenceId): ?>
                    <option value="<?= $block->escapeHtml($id) ?>"
                        <?= ($id == $block->getInfoData($block->getTransportName())) ?
                            ' selected="selected"' : '';
                        ?>>
                        <?= $block->escapeHtml($referenceId) ?>
                    </option>
                <?php endforeach; ?>
            </select>
        </div>
    </div>
</fieldset>
