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

/** @var Magento\Braintree\Block\Form $block */

$code = $block->escapeHtml($block->getMethodCode());
$ccType = $block->getInfoData('cc_type');
?>
<fieldset class="admin__fieldset payment-method"
          id="payment_form_<?= /* @noEscape */ $code ?>"
          style="display:none"
    >
    <div class="admin__field _required">
        <label class="label admin__field-label" for="<?= /* @noEscape */ $code ?>_cc_type" >
            <span><?= $block->escapeHtml(__('Credit Card Type')) ?></span>
        </label>
        <div class="admin__field-control control">
            <select id="<?= /* @noEscape */ $code ?>_cc_type" name="payment[cc_type]"
                    class="required-entry select admin__control-select validate-cc-type-select">
                <?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName) : ?>
                    <option value="<?= $block->escapeHtmlAttr($typeCode) ?>"
                        <?php if ($typeCode == $ccType) : ?> selected="selected"<?php endif; ?>>
                        <?= $block->escapeHtml($typeName) ?>
                    </option>
                <?php endforeach; ?>
            </select>
        </div>
    </div>
    <div class="admin__field _required">
        <label class="label admin__field-label">
            <span><?= $block->escapeHtml(__('Credit Card Number')) ?></span>
        </label>
        <div class="admin__field-control control">
            <div id="<?= /* @noEscape */ $code ?>_cc_number" class="admin__control-text hosted-control">
                <span class="icon-type"></span>
            </div>
            <div class="hosted-error">
                <?= $block->escapeHtml(__('Please, enter valid Credit Card Number')) ?>
            </div>
        </div>
    </div>

    <div class="admin__field _required">
        <label class="label admin__field-label">
            <span><?= $block->escapeHtml(__('Expiration Date')) ?></span>
        </label>
        <div class="admin__field-control control">
            <div class="hosted-date-wrap">
                <div id="<?= /* @noEscape */ $code ?>_cc_exp_month"
                     class="admin__control-text hosted-control hosted-date"></div>

                <div id="<?= /* @noEscape */ $code ?>_cc_exp_year"
                     class="admin__control-text hosted-control hosted-date"></div>

                <div class="hosted-error"><?= $block->escapeHtml(__('Please, enter valid Expiration Date')) ?></div>
            </div>
        </div>
    </div>
    <?php if ($block->hasVerification()) : ?>
        <div class="admin__field _required">
            <label class="label admin__field-label">
                <span><?= $block->escapeHtml(__('Card Verification Number')) ?></span>
            </label>
            <div class="admin__field-control control">
                <div id="<?= /* @noEscape */ $code ?>_cc_cid"
                     class="admin__control-text hosted-control hosted-cid"></div>

                <div class="hosted-error">
                    <?= $block->escapeHtml(__('Please, enter valid Card Verification Number')) ?>
                </div>
            </div>
        </div>
    <?php endif; ?>

    <?php if ($block->isVaultEnabled()) : ?>
        <div class="field-tooltip-content">
            <input type="checkbox"
                   id="<?= /* @noEscape */ $code ?>_vault"
                   name="payment[is_active_payment_token_enabler]"
                   class="admin__control-checkbox"/>
            <label class="label admin__field-label" for="<?= /* @noEscape */ $code ?>_vault">
                <span><?= $block->escapeHtml(__('Save for later use.')) ?></span>
            </label>
        </div>
    <?php endif; ?>

    <input type="hidden" id="<?= /* @noEscape */ $code ?>_payment_method_nonce"
           name="payment[payment_method_nonce]"/>
    <input type="submit" name="Submit" style="display: none;">
</fieldset>
