<?php
/**
 * aheadWorks Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/LICENSE-M1.txt
 *
 * @category   AW
 * @package    AW_Mobile
 * @copyright  Copyright (c) 2010-2011 aheadWorks Co. (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/LICENSE-M1.txt
 */
?>
<?php
/**
 * @see Enterprise_Reward_Block_Customer_Reward_History
 */
?>
<div class="account-block box">
    <h4 class="legend"><?php echo $this->__('Balance History'); ?></h4>

    <?php if ($history = $this->getHistory()):?>

    <?php echo $this->getChildHtml('pager') ?>

    <table id="reward-history" class="data-table">
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <col />
        <col width="1" />
        <thead>
            <tr>
                <th><?php echo $this->__('Balance'); ?></th>
                <th><?php echo $this->__('Amount'); ?></th>
                <th><?php echo $this->__('Points'); ?></th>
                <th><?php echo $this->__('Reason'); ?></th>
                <th><?php echo $this->__('Date'); ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach($history as $item): ?>
            <tr>
                <td class="a-right"><?php echo $this->getPointsBalance($item)?></td>
                <td class="a-right"><?php echo $this->getCurrencyBalance($item)?></td>
                <td class="a-right"><?php echo $this->getPointsDelta($item)?></td>
                <td>
                    <?php echo $this->escapeHtml($this->getMessage($item))?>
                    <?php if ($explanation = $this->getExplanation($item)):?><br /><small><?php echo $this->escapeHtml($explanation);?></small><?php endif;?>
                </td>
                <td>
                    <span class=""><?php echo $this->getDate($item)?></span>
                    <?php if ($expirationDate = $this->getExpirationDate($item)):?>
                    <small class=""><?php echo $this->__('Expires on %s', $expirationDate);?></small>
                    <?php endif;?>
                </td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <script type="text/javascript">decorateTable('reward-history')</script>

    <?php echo $this->getChildHtml('pager') ?>

    <?php else:?>

    <p><?php echo $this->__('There is no balance history yet.')?></p>

    <?php endif;?>
</div>
