<?= $this->extend('Layout/Starter') ?>

<?= $this->section('content') ?>

<div class="row">
    <div class="col-lg-12">
        <?= $this->include('Layout/msgStatus') ?>
    </div>

    <div class="col-lg-8">
        <div class="card mb-3">
            <div class="card-header text-white bg-danger">
                Recent Top 10 Sells
            </div>
            <div class="card-body bg-dark text-white">
                <div class="table-responsive">
                    <table class="table table-sm table-bordered table-hover text-center text-white">
                        <tbody>
                            <?php foreach ($history as $h) : ?>
                                <?php $in = explode("|", $h->info) ?>
                                <tr>
                                    <td><span class="align-middle badge  text-white"><?= $in[1] ?></span></td>
                                    <td><span class="align-middle badge  text-white"><?= $in[2] ?> Days</span></td>
                                    <td><span class="align-middle badge text-primary"><?= $in[3] ?> Devices</span></td>
                                    <td><i class="align-middle badge text-muted"><?= $time::parse($h->created_at)->humanize() ?></i></td>
                                </tr>
                            <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="col-lg-4">
        <div class="card mb-3">
            <div class="card-header text-center text-white bg-danger">
                Information
            </div>
            <div class="card-body  text-white bg-dark ">
                <ul class="list-group list-hover mb-3">
                    <li class="list-group-item list-group-item-action d-flex justify-content-between bg-dark text-white align-items-center">
                        Type
                        <span class="badge text-white">
                            <?= getLevel($user->level) ?>
                        </span>
                    </li>
                    <li class="list-group-item list-group-item-action d-flex justify-content-between bg-dark text-white align-items-center">
                        Credits
                        <span class="badge text-white">
                            <?= $user->saldo ?>
                        </span>
                    </li>
                </ul>
                <ul class="list-group">
                    <li class="list-group-item list-group-item-action d-flex justify-content-between bg-dark text-white align-items-center">
                        Login Time
                        <span class="badge text-white">
                            <?= $time::parse(session()->time_since)->humanize() ?>
                        </span>
                    </li>
                    <li class="list-group-item list-group-item-action d-flex justify-content-between bg-dark text-white align-items-center">
                        Auto Logout
                        <span class="badge text-white">
                            <?= $time::now()->difference($time::parse(session()->time_login))->humanize() ?>
                        </span>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<?= $this->endSection() ?>