<?php
/* Smarty version 4.5.6, created on 2025-12-20 23:17:55
  from '/var/www/html/tivi/panel/templates/reports/activity.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.6',
  'unifunc' => 'content_694720935d6320_29121433',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '3aad213b44947bc2d50b7c3ee2048b607eee9ced' => 
    array (
      0 => '/var/www/html/tivi/panel/templates/reports/activity.tpl',
      1 => 1766254199,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_694720935d6320_29121433 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_loadInheritance();
$_smarty_tpl->inheritance->init($_smarty_tpl, true);
?>


<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_1399492739694720935cd7f7_81714895', "content");
?>

<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl, "layout.tpl");
}
/* {block "content"} */
class Block_1399492739694720935cd7f7_81714895 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content' => 
  array (
    0 => 'Block_1399492739694720935cd7f7_81714895',
  ),
);
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/var/www/html/tivi/vendor/smarty/smarty/libs/plugins/modifier.date_format.php','function'=>'smarty_modifier_date_format',),));
?>

<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h4 class="mb-1">Raport aktywności</h4>
            <p class="text-muted mb-0">Statystyki aktywności użytkowników</p>
        </div>
        <div class="btn-group">
            <a href="?days=7" class="btn btn-outline-secondary <?php if ($_smarty_tpl->tpl_vars['days']->value == 7) {?>active<?php }?>">7 dni</a>
            <a href="?days=30" class="btn btn-outline-secondary <?php if ($_smarty_tpl->tpl_vars['days']->value == 30) {?>active<?php }?>">30 dni</a>
            <a href="?days=90" class="btn btn-outline-secondary <?php if ($_smarty_tpl->tpl_vars['days']->value == 90) {?>active<?php }?>">90 dni</a>
        </div>
    </div>

    <!-- Podsumowanie -->
    <div class="row g-4 mb-4">
        <div class="col-sm-6 col-xl-3">
            <div class="card bg-primary bg-opacity-10 border-primary">
                <div class="card-body">
                    <h6 class="text-primary">Aktywni użytkownicy</h6>
                    <h2 class="mb-0"><?php echo (($tmp = $_smarty_tpl->tpl_vars['report']->value['summary']['active_users'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h2>
                </div>
            </div>
        </div>
        <div class="col-sm-6 col-xl-3">
            <div class="card bg-success bg-opacity-10 border-success">
                <div class="card-body">
                    <h6 class="text-success">Logowania (<?php echo $_smarty_tpl->tpl_vars['days']->value;?>
 dni)</h6>
                    <h2 class="mb-0"><?php echo (($tmp = $_smarty_tpl->tpl_vars['report']->value['summary']['logins_count'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h2>
                </div>
            </div>
        </div>
        <div class="col-sm-6 col-xl-3">
            <div class="card bg-warning bg-opacity-10 border-warning">
                <div class="card-body">
                    <h6 class="text-warning">Nowi użytkownicy</h6>
                    <h2 class="mb-0"><?php echo (($tmp = $_smarty_tpl->tpl_vars['report']->value['summary']['new_users'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h2>
                </div>
            </div>
        </div>
        <div class="col-sm-6 col-xl-3">
            <div class="card bg-info bg-opacity-10 border-info">
                <div class="card-body">
                    <h6 class="text-info">Akcje w logach</h6>
                    <h2 class="mb-0"><?php echo (($tmp = $_smarty_tpl->tpl_vars['report']->value['summary']['log_entries'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h2>
                </div>
            </div>
        </div>
    </div>

    <div class="row g-4">
        <!-- Aktywność użytkowników -->
        <div class="col-lg-8">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title mb-0"><i class="bi bi-people me-2"></i>Aktywność użytkowników</h5>
                </div>
                <div class="card-body p-0">
                    <div class="table-responsive">
                        <table class="table table-hover mb-0">
                            <thead>
                                <tr>
                                    <th>Użytkownik</th>
                                    <th>Rola</th>
                                    <th>Logowania</th>
                                    <th>Nieudane</th>
                                    <th>Akcje</th>
                                    <th>Ostatnie logowanie</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['report']->value['user_stats'], 'user');
$_smarty_tpl->tpl_vars['user']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['user']->value) {
$_smarty_tpl->tpl_vars['user']->do_else = false;
?>
                                <tr>
                                    <td><strong><?php echo $_smarty_tpl->tpl_vars['user']->value['username'];?>
</strong></td>
                                    <td>
                                        <?php if ($_smarty_tpl->tpl_vars['user']->value['role'] == 'admin') {?><span class="badge bg-danger">Admin</span>
                                        <?php } elseif ($_smarty_tpl->tpl_vars['user']->value['role'] == 'reseller') {?><span class="badge bg-primary">Reseller</span>
                                        <?php } else { ?><span class="badge bg-secondary">User</span><?php }?>
                                    </td>
                                    <td><span class="badge bg-success"><?php echo (($tmp = $_smarty_tpl->tpl_vars['user']->value['logins_period'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</span></td>
                                    <td>
                                        <?php if ($_smarty_tpl->tpl_vars['user']->value['failed_logins'] > 0) {?>
                                        <span class="badge bg-danger"><?php echo $_smarty_tpl->tpl_vars['user']->value['failed_logins'];?>
</span>
                                        <?php } else { ?>
                                        <span class="text-muted">0</span>
                                        <?php }?>
                                    </td>
                                    <td><?php echo (($tmp = $_smarty_tpl->tpl_vars['user']->value['actions_count'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</td>
                                    <td>
                                        <?php if ($_smarty_tpl->tpl_vars['user']->value['last_login']) {?>
                                        <?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['user']->value['last_login'],"%d.%m.%Y %H:%M");?>

                                        <?php } else { ?>
                                        <span class="text-muted">Nigdy</span>
                                        <?php }?>
                                    </td>
                                </tr>
                                <?php
}
if ($_smarty_tpl->tpl_vars['user']->do_else) {
?>
                                <tr><td colspan="6" class="text-center py-4 text-muted">Brak danych</td></tr>
                                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <!-- Top akcji -->
        <div class="col-lg-4">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title mb-0"><i class="bi bi-bar-chart me-2"></i>Najczęstsze akcje</h5>
                </div>
                <div class="card-body p-0">
                    <ul class="list-group list-group-flush">
                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['report']->value['top_actions'], 'action');
$_smarty_tpl->tpl_vars['action']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['action']->value) {
$_smarty_tpl->tpl_vars['action']->do_else = false;
?>
                        <li class="list-group-item d-flex justify-content-between align-items-center">
                            <span><?php echo $_smarty_tpl->tpl_vars['action']->value['action'];?>
</span>
                            <span class="badge bg-primary rounded-pill"><?php echo $_smarty_tpl->tpl_vars['action']->value['count'];?>
</span>
                        </li>
                        <?php
}
if ($_smarty_tpl->tpl_vars['action']->do_else) {
?>
                        <li class="list-group-item text-center text-muted">Brak danych</li>
                        <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
}
}
/* {/block "content"} */
}
