<?php
/**
 * Maho
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2022 The OpenMage Contributors (https://openmage.org)
 * @copyright   Copyright (c) 2024 Maho (https://mahocommerce.com)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php $_code=$this->getMethodCode() ?>
<ul class="form-list" id="payment_form_<?= $_code ?>" style="display:none;">
<?php /*
    <li>
        <div class="input-box">
            <label for="<?= $_code ?>_cc_owner" class="required"><em>*</em><?= $this->__('Name on Card') ?></label>
            <input type="text" title="<?= $this->__('Name on Card') ?>" class="input-text required-entry" id="<?= $_code ?>_cc_owner" name="payment[cc_owner]" value="<?= $this->escapeHtml($this->getInfoData('cc_owner')) ?>" />
        </div>
    </li>
*/ ?>
    <li>
        <label for="<?= $_code ?>_cc_type" class="required"><em>*</em><?= $this->__('Credit Card Type') ?></label>
        <div class="input-box">
            <select id="<?= $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
                <option value=""><?= $this->__('--Please Select--') ?></option>
            <?php $_ccType = $this->getInfoData('cc_type') ?>
            <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
                <option value="<?= $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?= $_typeName ?></option>
            <?php endforeach ?>
            </select>
        </div>
    </li>
    <li>
        <label for="<?= $_code ?>_cc_number" class="required"><em>*</em><?= $this->__('Credit Card Number') ?></label>
        <div class="input-box">
            <input type="text" id="<?= $_code ?>_cc_number" name="payment[cc_number]" title="<?= Mage::helper('core')->jsQuoteEscape($this->__('Credit Card Number')) ?>" class="input-text validate-cc-number validate-cc-type" value="" />
        </div>
    </li>
    <li id="<?= $_code ?>_cc_type_exp_div">
        <label for="<?= $_code ?>_expiration" class="required"><em>*</em><?= $this->__('Expiration Date') ?></label>
        <div class="input-box">
            <div class="v-fix">
                <select id="<?= $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
                <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
                <?php foreach ($this->getCcMonths() as $k=>$v): ?>
                    <option value="<?= $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?= $v ?></option>
                <?php endforeach ?>
                </select>
            </div>
            <div class="v-fix">
                <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
                <select id="<?= $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
                <?php foreach ($this->getCcYears() as $k=>$v): ?>
                    <option value="<?= $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?= $v ?></option>
                <?php endforeach ?>
                </select>
            </div>
        </div>
    </li>
    <?= $this->getChildHtml() ?>
    <?php if($this->hasVerification()): ?>
    <li id="<?= $_code ?>_cc_type_cvv_div">
        <label for="<?= $_code ?>_cc_cid" class="required"><em>*</em><?= $this->__('Card Verification Number') ?></label>
        <div class="input-box">
            <div class="v-fix">
                <input type="text" title="<?= Mage::helper('core')->jsQuoteEscape($this->__('Card Verification Number')) ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?= $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
            </div>
            <a href="#" class="cvv-what-is-this"><?= $this->__('What is this?') ?></a>
        </div>
    </li>
    <?php endif ?>

    <?php if ($this->hasSsCardType()): ?>
    <li id="<?= $_code ?>_cc_type_ss_div">
        <ul class="inner-form">
            <li class="form-alt"><label for="<?= $_code ?>_cc_issue" class="required"><em>*</em><?= $this->__('Switch/Solo/Maestro Only') ?></label></li>
            <li>
                <label for="<?= $_code ?>_cc_issue"><?= $this->__('Issue Number') ?>:</label>
                <span class="input-box">
                    <input type="text" title="<?= Mage::helper('core')->jsQuoteEscape($this->__('Issue Number')) ?>" class="input-text validate-cc-ukss cvv" id="<?= $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
                </span>
            </li>

            <li>
                <label for="<?= $_code ?>_start_month"><?= $this->__('Start Date') ?>:</label>
                <div class="input-box">
                    <div class="v-fix">
                        <select id="<?= $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
                        <?php foreach ($this->getCcMonths() as $k=>$v): ?>
                            <option value="<?= $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?= $v ?></option>
                        <?php endforeach ?>
                        </select>
                    </div>
                    <div class="v-fix">
                        <select id="<?= $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
                        <?php foreach ($this->getSsStartYears() as $k=>$v): ?>
                            <option value="<?= $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?= $v ?></option>
                        <?php endforeach ?>
                        </select>
                    </div>
                </div>
            </li>
            <li class="adv-container">&nbsp;</li>
        </ul>
        <script type="text/javascript">
            var SSChecked<?= $_code ?> = function() {
                var elm = document.getElementById('<?= $_code ?>_cc_type');
                var ssDiv = document.getElementById('<?= $_code ?>_cc_type_ss_div');
                if (['SS','SM','SO'].indexOf(elm.value) !== -1) {
                    ssDiv.style.display = 'block';
                } else {
                    ssDiv.style.display = 'none';
                }
            };

            document.getElementById('<?= $_code ?>_cc_type').addEventListener('change', SSChecked<?= $_code ?>);
            SSChecked<?= $_code ?>();
        </script>
    </li>
    <?php endif ?>
</ul>
