<?php
/**
 * Copyright © 2016 Magento. 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_<?php /* @noEscape */ echo $code; ?>" style="display:none;">
    <div class="admin__field _required">
        <label class="admin__field-label"
               for="<?php /* @noEscape */ echo $code; ?>_ba_agreement_id">
            <span><?php echo $block->escapeHtml(__('Billing Agreement')); ?></span>
        </label>
        <div class="admin__field-control">
            <select id="<?php /* @noEscape */ echo $code; ?>_ba_agreement_id"
                    name="payment[<?php echo $block->escapeHtml($block->getTransportName()); ?>]"
                    class="required-entry admin__control-select">
                <option value=""><?php echo $block->escapeHtml(__('Please Select')); ?></option>
                <?php foreach ($block->getBillingAgreements() as $id => $referenceId): ?>
                    <option value="<?php echo $block->escapeHtml($id); ?>"
                        <?php echo ($id == $block->getInfoData($block->getTransportName())) ?
                            ' selected="selected"' : '';
                        ?>>
                        <?php echo $block->escapeHtml($referenceId); ?>
                    </option>
                <?php endforeach; ?>
            </select>
        </div>
    </div>
</fieldset>
