<?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,
    ]
);
?>
<!-- List of Users -->
<?php if ($total): ?>
    <div class="space-y-3">
        <?php foreach ($list as $usr): ?>
            <?= $this->fetch('users::user_row', ['item' => $usr]) ?>
        <?php endforeach ?>
    </div>
<?php else: ?>
    <div class="flex justify-center">
        <div class="w-full max-w-md">
            <div class="bg-blue-100 border border-blue-400 text-blue-700 px-4 py-3 rounded"><?= __('List is empty') ?></div>
        </div>
    </div>
<?php endif ?>

<?php if ($total): ?>
    <div class="mt-4">
        <div class="text-gray-600 mb-2"><?= __('Total') ?>: <?= $total ?></div>
        <!-- Page switching -->
        <?php if ($total > $user->config->kmess): ?>
            <div class="mt-2"><?= $pagination ?></div>
        <?php endif ?>
    </div>
<?php endif; ?>

<div class="mt-6 space-y-2">
    <div>
        <a href="../search/" class="text-blue-600 hover:text-blue-800 hover:underline"><?= __('User Search') ?></a>
    </div>
    <div>
        <a href="../" class="text-blue-600 hover:text-blue-800 hover:underline"><?= __('Back') ?></a>
    </div>
</div>