<?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 $item
 */

?>

<div class="user-row">
    <div class="d-flex align-items-start">
        <div class="user-avatar mr-2 mr-md-4">
            <div class="avatar-image rounded-circle overflow-hidden">
                <img src="<?= $this->avatar($item['id'] ?? 0) ?>" class="img-fluid" alt=".">
            </div>
            <div class="user-status <?= $item['user_is_online'] ? 'online' : 'offline' ?> shadow"></div>
        </div>
        <div class="overflow-auto flex-grow-1">
            <div class="user-name">
                <?php if (! empty($item['user_profile_link'])): ?>
                    <a href="<?= $item['user_profile_link'] ?>" class="user-login mr-2"><?= $item['name'] ?></a>
                <?php else: ?>
                    <a class="user-login mr-2"><?= $item['name'] ?></a>
                <?php endif; ?>
            </div>
            <?php if (! empty($item['place'])): ?>
                <div class="text">
                    <?= $item['place'] ?>
                </div>
            <?php endif; ?>
        </div>
    </div>
    <?php if ($user->rights >= 3): ?>
        <div class="post-footer d-flex justify-content-between border-top pt-2 mt-2">
            <div class="post-user-info d-flex overflow-hidden small align-items-center">
                <?php if ($user->rights): ?>
                    <div class="user-ip mr-2">
                        <a href="<?= $item['search_ip_url'] ?>"><?= $item['ip'] ?></a>
                        <?php if (! empty($item['ip_via_proxy'])): ?>
                            / <a href="<?= $item['search_ip_via_proxy_url'] ?>"><?= $item['ip_via_proxy'] ?></a>
                        <?php endif; ?>
                    </div>
                    <div class="useragent">
                        <span><?= $item['browser'] ?></span>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    <?php endif; ?>
</div>
