<?php
/* Smarty version 4.5.6, created on 2025-12-08 09:04:26
  from '/var/www/html/tivi/panel/templates/logs/api.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.6',
  'unifunc' => 'content_6936868a730ec2_01940262',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'a67db029be03939d432254587f22718784845558' => 
    array (
      0 => '/var/www/html/tivi/panel/templates/logs/api.tpl',
      1 => 1765179105,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_6936868a730ec2_01940262 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_loadInheritance();
$_smarty_tpl->inheritance->init($_smarty_tpl, true);
?>


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

<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl, "layout.tpl");
}
/* {block "content"} */
class Block_7849890426936868a727457_88478949 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content' => 
  array (
    0 => 'Block_7849890426936868a727457_88478949',
  ),
);
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">
    <!-- Header -->
    <div class="d-flex flex-wrap justify-content-between align-items-center mb-4">
        <div>
            <h4 class="mb-1">Logi API</h4>
            <p class="text-muted mb-0">Historia żądań do API playlist</p>
        </div>
    </div>

    <!-- Tabs -->
    <ul class="nav nav-tabs mb-4">
        <li class="nav-item">
            <a class="nav-link" href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/admin/logs">
                <i class="bi bi-journal-text me-1"></i>Logi aplikacji
            </a>
        </li>
        <li class="nav-item">
            <a class="nav-link active" href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/admin/logs/api">
                <i class="bi bi-cloud-arrow-down me-1"></i>Logi API
            </a>
        </li>
    </ul>

    <!-- Logs Table -->
    <div class="card">
        <div class="card-body p-0">
            <div class="table-responsive">
                <table class="table table-hover align-middle mb-0">
                    <thead>
                        <tr>
                            <th>Data</th>
                            <th>MAC</th>
                            <th>Kod</th>
                            <th>Urządzenie</th>
                            <th>Użytkownik</th>
                            <th>Status</th>
                            <th>Playlisty</th>
                            <th>IP</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['logs']->value, 'log');
$_smarty_tpl->tpl_vars['log']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['log']->value) {
$_smarty_tpl->tpl_vars['log']->do_else = false;
?>
                        <tr>
                            <td>
                                <span class="text-nowrap"><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['log']->value['created_at'],"%d.%m.%Y");?>
</span>
                                <br><small class="text-muted"><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['log']->value['created_at'],"%H:%M:%S");?>
</small>
                            </td>
                            <td><code><?php echo (($tmp = $_smarty_tpl->tpl_vars['log']->value['mac'] ?? null)===null||$tmp==='' ? '-' ?? null : $tmp);?>
</code></td>
                            <td><code><?php echo (($tmp = $_smarty_tpl->tpl_vars['log']->value['code'] ?? null)===null||$tmp==='' ? '-' ?? null : $tmp);?>
</code></td>
                            <td>
                                <?php if ($_smarty_tpl->tpl_vars['log']->value['device_name']) {?>
                                <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/playlists?device_id=<?php echo $_smarty_tpl->tpl_vars['log']->value['device_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['log']->value['device_name'];?>
</a>
                                <?php } else { ?>
                                <span class="text-muted">Nieznane</span>
                                <?php }?>
                            </td>
                            <td><?php echo (($tmp = $_smarty_tpl->tpl_vars['log']->value['username'] ?? null)===null||$tmp==='' ? '<span class="text-muted">-</span>' ?? null : $tmp);?>
</td>
                            <td>
                                <span class="badge bg-<?php if ($_smarty_tpl->tpl_vars['log']->value['response_status'] == 'success') {?>success<?php } elseif ($_smarty_tpl->tpl_vars['log']->value['response_status'] == 'blocked') {?>warning<?php } else { ?>danger<?php }?>">
                                    <?php echo $_smarty_tpl->tpl_vars['log']->value['response_status'];?>

                                </span>
                            </td>
                            <td><?php echo $_smarty_tpl->tpl_vars['log']->value['playlists_count'];?>
</td>
                            <td><code><?php echo $_smarty_tpl->tpl_vars['log']->value['ip'];?>
</code></td>
                        </tr>
                        <?php
}
if ($_smarty_tpl->tpl_vars['log']->do_else) {
?>
                        <tr>
                            <td colspan="8" class="text-center py-5">
                                <div class="text-muted mb-3">
                                    <i class="bi bi-cloud" style="font-size: 3rem;"></i>
                                </div>
                                <p class="mb-0">Brak logów API</p>
                            </td>
                        </tr>
                        <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                    </tbody>
                </table>
            </div>
        </div>

        <?php if ($_smarty_tpl->tpl_vars['pagination']->value['total_pages'] > 1) {?>
        <div class="card-footer">
            <nav>
                <ul class="pagination pagination-sm mb-0 justify-content-center">
                    <li class="page-item<?php if (!$_smarty_tpl->tpl_vars['pagination']->value['has_prev']) {?> disabled<?php }?>">
                        <a class="page-link" href="?page=<?php echo $_smarty_tpl->tpl_vars['pagination']->value['current_page']-1;?>
">
                            <i class="bi bi-chevron-left"></i>
                        </a>
                    </li>
                    <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['pagination']->value['pages'], 'page');
$_smarty_tpl->tpl_vars['page']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['page']->value) {
$_smarty_tpl->tpl_vars['page']->do_else = false;
?>
                        <?php if ($_smarty_tpl->tpl_vars['page']->value === '...') {?>
                        <li class="page-item disabled"><span class="page-link">...</span></li>
                        <?php } else { ?>
                        <li class="page-item<?php if ($_smarty_tpl->tpl_vars['page']->value == $_smarty_tpl->tpl_vars['pagination']->value['current_page']) {?> active<?php }?>">
                            <a class="page-link" href="?page=<?php echo $_smarty_tpl->tpl_vars['page']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['page']->value;?>
</a>
                        </li>
                        <?php }?>
                    <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                    <li class="page-item<?php if (!$_smarty_tpl->tpl_vars['pagination']->value['has_next']) {?> disabled<?php }?>">
                        <a class="page-link" href="?page=<?php echo $_smarty_tpl->tpl_vars['pagination']->value['current_page']+1;?>
">
                            <i class="bi bi-chevron-right"></i>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <?php }?>
    </div>
</div>
<?php
}
}
/* {/block "content"} */
}
