<?php
/**
 * Copyright © 2017 ebizmarts. All rights reserved.
 * See LICENSE.txt for license details.
 */

?>
<?php
/**
 * @var $block \Ebizmarts\SagePaySuite\Block\Customer\TokenList
 */
?>
<?php $_items = $block->getItems(); ?>

<?php if (count($_items)): ?>
    <div class="tokens-wrapper sagepaysuite-tokens">
        <ul class="tokens-list">
        <?php foreach ($_items as $_item): ?>
            <li class="token-item">

                <div class="jp-card-container">
                    <div class="jp-card jp-card-identified jp-card-unknown jp-card-<?php /* @escapeNotVerified */ echo __(strtolower($_item["cc_type"])) ?>">
                        <div class="jp-card-front">
                            <div class="jp-card-logo jp-card-elo">
                                <div class="e">e</div>
                                <div class="l">l</div>
                                <div class="o">o</div>
                            </div>
                            <div class="jp-card-logo jp-card-visa">Visa</div>
                            <div class="jp-card-logo jp-card-visaelectron">Visa
                                <div class="elec">Electron</div>
                            </div>
                            <div class="jp-card-logo jp-card-mastercard">Mastercard</div>
                            <div class="jp-card-logo jp-card-maestro">Maestro</div>
                            <div class="jp-card-logo jp-card-amex"></div>
                            <div class="jp-card-logo jp-card-discover">discover</div>
                            <div class="jp-card-logo jp-card-dinersclub"></div>
                            <div class="jp-card-logo jp-card-dankort">
                                <div class="dk">
                                    <div class="d"></div>
                                    <div class="k"></div>
                                </div>
                            </div>
                            <div class="jp-card-logo jp-card-jcb">
                                <div class="j">J</div>
                                <div class="c">C</div>
                                <div class="b">B</div>
                            </div>
                            <div class="jp-card-lower">
                                <div class="jp-card-shiny"></div>
                                <div class="jp-card-cvc jp-card-display">•••</div>
                                <div class="jp-card-number jp-card-display jp-card-valid">•••• •••• •••• <?php /* @escapeNotVerified */ echo __(ucfirst($_item['cc_last_4'])) ?></div>
                                <div class="jp-card-name jp-card-display jp-card-valid"></div>
                                <div class="jp-card-expiry jp-card-display" data-before="month/year" data-after="valid
thru"><?php /* @escapeNotVerified */ echo $_item["cc_exp_month"] . "/" . $_item["cc_exp_year"] ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="actions">
                    <a href="<?php echo $this->getUrl('sagepaysuite/token/delete', ["token_id"=>$_item["id"], "customer_area" => true]); ?>" class="action delete">
                        <span>Delete</span>
                    </a>
                </div>
            </li>
        <?php endforeach; ?>
        </ul>
    </div>
<?php else: ?>
    <div class="message info empty"><span><?php /* @escapeNotVerified */ echo __('You have not saved any credit card tokens yet.'); ?></span></div>
<?php endif; ?>


<?php if(count($_items) >= \Ebizmarts\SagePaySuite\Model\Config::MAX_TOKENS_PER_CUSTOMER){ ?>
    <!--Max tokens per customer message-->
    <div class="message info warning"><span><?php /* @escapeNotVerified */ echo __('You are currently using all your credit card token slots.'); ?></span></div>
<?php } ?>