<?php if ($lastUsersList) : ?>
<div class="admin-last admin-lastusers">
    <h2><?php __e('Last %s Customers', $num); ?></h2>
    <div class="am-grid-container">
        <table class="am-grid grid-no-highlight">
            <tr>
                <th class="helper-corner-left"><?php __e('User') ?></th>
                <th><?php __e('Status') ?></th>
                <th class="container-width-narrow-hide"><?php __e('Added') ?></th>
                <th class="helper-corner-right"><?php __e('Payments') ?></th>
            </tr>
            <?php foreach ($lastUsersList as $u): ?>
            <tr class="am-grid-row <?php echo (@$rownum++%2) ? 'odd' : 'even' ?>">
                <td><?php if (trim($u->getName())): ?>
                        <strong><?php p($u->getName()) ?></strong>
                        (<a class="link" href="<?php echo $this->userUrl($u->user_id) ?>" data-tooltip-url="<?php echo $this->url('admin-users/card', "id={$u->user_id}") ?>"><?php p($u->login) ?></a>)
                    <?php else: ?>
                        <a class="link" href="<?php echo $this->userUrl($u->user_id) ?>" data-tooltip-url="<?php echo $this->url('admin-users/card', "id={$u->user_id}") ?>"><?php p($u->login) ?></a>
                    <?php endif; ?>
                    <br />
                    <?php p($u->email) ?></td>
                <td>
                    <?php
                    switch ($u->status)
                    {
                        case User::STATUS_PENDING:
                            if ($u->payments_count) {
                                if ((float)$u->paid > 0) {
                                    echo '<span class="user-status user-status-future">' . ___('Future') . '</span>';
                                } else {
                                    echo '<span class="user-status user-status-refunded">' . ___('Refunded') . '</span>';
                                }
                            } else {
                                echo '<span class="user-status user-status-pending">' . ___('Pending') . '</span>';
                            }
                            break;
                        case User::STATUS_ACTIVE:
                            echo '<span class="user-status user-status-active">' . ___('Active') . '</span>';
                            break;
                        case User::STATUS_EXPIRED:
                            echo '<span class="user-status user-status-expired">' . ___('Expired') . '</span>';
                            break;
                    }
                    ?>
                </td>
                <td class="container-width-narrow-hide"><time datetime="<?php p(date('c', amstrtotime($u->added))) ?>" title="<?php p($this->getElapsedTime($u->added)) ?>">
                    <?php if (sqlDate($u->added) == sqlDate('today')) : ?>
                        <?php p(amTime($u->added)) ?>
                    <?php else: ?>
                        <?php p(amDate($u->added)) ?><br /><small style="color:#aaa"><?php p(amTime($u->added)) ?></small>
                    <?php endif; ?>
                    </time></td>
                <td>
                    <?php if (!$u->payments_count): ?>
                        <?php __e('Never') ?>
                    <?php else: ?>
                        <a class="link" href="<?php echo $this->url('admin-user-payments/index/user_id/'.$u->user_id) ?>"><?php p($u->payments_count) ?> - <?php p(Am_Currency::render($u->paid)) ?></a>
                    <?php endif; ?>
                </td>
            </tr>
            <tr class="am-grid-row <?php echo (@$arownum++%2) ? 'odd' : 'even' ?>">
                <td colspan="4" class="container-width-narrow-show">
                    <div class="admin-last_time">
                        &#x1f550; <time datetime="<?php p(date('c', amstrtotime($u->added))) ?>" title="<?php p($this->getElapsedTime($u->added)) ?>"><?php p(amDatetime($u->added)) ?></time>
                    </div>
                </td>
            </tr>
            <?php endforeach ?>
        </table>
    </div>
</div>
<?php else: ?>
<div class="widget-nodata">
    <h2><?php __e('Last %s Customers', $num); ?></h2>
    <p><?php __e("You don't have any users yet") ?></p>
</div>
<?php endif; ?>