<?php

/**
 * This file is part of JohnCMS Content Management System.
 *
 * @copyright JohnCMS Community
 * @license   https://opensource.org/licenses/GPL-3.0 GPL-3.0
 * @link      https://johncms.com JohnCMS Project
 */

/**
 * @var $title
 * @var $page_title
 * @var $data
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $page_title,
    ]
);
?>
<div class="mb-2">
    <?php foreach ($data['filters'] as $tab): ?>
        <a href="<?= $tab['url'] ?>" class="btn btn-outline-secondary mb-1 <?= ($tab['active'] ? 'active' : '') ?>"><?= $tab['name'] ?></a>
    <?php endforeach; ?>
</div>
<!-- List of Users -->
<?php if ($data['total'] > 0): ?>
    <?php foreach ($data['items'] as $item): ?>
        <?= $this->fetch('online::user_row', ['item' => $item]) ?>
    <?php endforeach ?>
<?php else: ?>
    <div class="row">
        <div class="col-md-6">
            <div class="alert alert-info"><?= __('List is empty') ?></div>
        </div>
    </div>
<?php endif ?>

<?php if ($data['total'] > 0): ?>
    <div>
        <div class="my-2"><?= __('Total') ?>: <?= $data['total'] ?></div>
        <!-- Page switching -->
        <?= $data['pagination'] ?>
    </div>
<?php endif; ?>

