<?php
/* Smarty version 4.5.6, created on 2025-12-25 08:06:34
  from '/var/www/html/tivi/panel/templates/profile/index.tpl' */

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


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

<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl, "layout.tpl");
}
/* {block "content"} */
class Block_532174547694ce27a0d63d4_76376303 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content' => 
  array (
    0 => 'Block_532174547694ce27a0d63d4_76376303',
  ),
);
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">Mój profil</h4>
            <p class="text-muted mb-0">Informacje o Twoim koncie</p>
        </div>
        <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/profile/edit" class="btn btn-primary">
            <i class="bi bi-pencil me-1"></i>Edytuj profil
        </a>
    </div>

    <div class="row g-4">
        <!-- Dane profilu -->
        <div class="col-lg-4">
            <div class="card">
                <div class="card-body text-center py-4">
                    <div class="mb-3">
                        <?php if ($_smarty_tpl->tpl_vars['profile']->value['avatar']) {?>
                        <img src="/uploads/avatars/<?php echo $_smarty_tpl->tpl_vars['profile']->value['avatar'];?>
" class="rounded-circle" style="width: 120px; height: 120px; object-fit: cover;">
                        <?php } else { ?>
                        <div class="rounded-circle bg-primary bg-opacity-10 d-inline-flex align-items-center justify-content-center" style="width: 120px; height: 120px;">
                            <i class="bi bi-person text-primary" style="font-size: 4rem;"></i>
                        </div>
                        <?php }?>
                    </div>
                    <h4 class="mb-1"><?php echo $_smarty_tpl->tpl_vars['currentUser']->value['username'];?>
</h4>
                    <p class="text-muted mb-2">
                        <?php if ($_smarty_tpl->tpl_vars['isAdmin']->value) {?>Administrator
                        <?php } elseif ($_smarty_tpl->tpl_vars['isReseller']->value) {?>Reseller
                        <?php } else { ?>Użytkownik<?php }?>
                    </p>
                    <?php if ($_smarty_tpl->tpl_vars['profile']->value['full_name']) {?>
                    <p class="mb-0"><?php echo $_smarty_tpl->tpl_vars['profile']->value['full_name'];?>
</p>
                    <?php }?>
                </div>
            </div>

            <!-- Dane kontaktowe -->
            <div class="card mt-4">
                <div class="card-header">
                    <h5 class="card-title mb-0"><i class="bi bi-person-lines-fill me-2"></i>Dane kontaktowe</h5>
                </div>
                <div class="card-body">
                    <div class="mb-3">
                        <small class="text-muted">Email</small>
                        <p class="mb-0"><?php echo (($tmp = $_smarty_tpl->tpl_vars['profile']->value['email'] ?? null)===null||$tmp==='' ? '<span class="text-muted">Nie podano</span>' ?? null : $tmp);?>
</p>
                    </div>
                    <div class="mb-3">
                        <small class="text-muted">Telefon</small>
                        <p class="mb-0"><?php echo (($tmp = $_smarty_tpl->tpl_vars['profile']->value['phone'] ?? null)===null||$tmp==='' ? '<span class="text-muted">Nie podano</span>' ?? null : $tmp);?>
</p>
                    </div>
                    <div class="mb-0">
                        <small class="text-muted">Firma</small>
                        <p class="mb-0"><?php echo (($tmp = $_smarty_tpl->tpl_vars['profile']->value['company'] ?? null)===null||$tmp==='' ? '<span class="text-muted">Nie podano</span>' ?? null : $tmp);?>
</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- Statystyki i informacje -->
        <div class="col-lg-8">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title mb-0"><i class="bi bi-graph-up me-2"></i>Statystyki konta</h5>
                </div>
                <div class="card-body">
                    <div class="row g-4">
                        <div class="col-md-4">
                            <div class="text-center p-3 bg-primary bg-opacity-10 rounded">
                                <h3 class="text-primary mb-1"><?php echo (($tmp = $_smarty_tpl->tpl_vars['currentUser']->value['devices_count'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h3>
                                <small class="text-muted">Urządzeń</small>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="text-center p-3 bg-success bg-opacity-10 rounded">
                                <h3 class="text-success mb-1"><?php echo (($tmp = $_smarty_tpl->tpl_vars['currentUser']->value['login_count'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h3>
                                <small class="text-muted">Logowań</small>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="text-center p-3 bg-info bg-opacity-10 rounded">
                                <h3 class="text-info mb-1"><?php echo (($tmp = $_smarty_tpl->tpl_vars['currentUser']->value['api_calls_count'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h3>
                                <small class="text-muted">Wywołań API</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Informacje o koncie -->
            <div class="card mt-4">
                <div class="card-header">
                    <h5 class="card-title mb-0"><i class="bi bi-info-circle me-2"></i>Informacje o koncie</h5>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-6">
                            <p><strong>Data utworzenia:</strong><br><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['currentUser']->value['created_at'],"%d.%m.%Y %H:%M");?>
</p>
                            <p><strong>Ostatnie logowanie:</strong><br>
                                <?php if ($_smarty_tpl->tpl_vars['currentUser']->value['last_login']) {?>
                                <?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['currentUser']->value['last_login'],"%d.%m.%Y %H:%M");?>

                                <?php } else { ?>
                                <span class="text-muted">Brak</span>
                                <?php }?>
                            </p>
                        </div>
                        <div class="col-md-6">
                            <p><strong>Strefa czasowa:</strong><br><?php echo (($tmp = $_smarty_tpl->tpl_vars['profile']->value['timezone'] ?? null)===null||$tmp==='' ? 'Europe/Warsaw' ?? null : $tmp);?>
</p>
                            <p><strong>Język:</strong><br><?php if ($_smarty_tpl->tpl_vars['profile']->value['language'] == 'pl') {?>Polski<?php } else { ?>English<?php }?></p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Ostatnie logowania -->
            <div class="card mt-4">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h5 class="card-title mb-0"><i class="bi bi-clock-history me-2"></i>Ostatnie logowania</h5>
                    <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/profile/login-history" class="btn btn-sm btn-outline-secondary">Zobacz wszystkie</a>
                </div>
                <div class="card-body p-0">
                    <div class="table-responsive">
                        <table class="table table-hover mb-0">
                            <thead>
                                <tr>
                                    <th>IP</th>
                                    <th>Przeglądarka</th>
                                    <th>Status</th>
                                    <th>Data</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['loginHistory']->value, 'login');
$_smarty_tpl->tpl_vars['login']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['login']->value) {
$_smarty_tpl->tpl_vars['login']->do_else = false;
?>
                                <tr>
                                    <td><code><?php echo $_smarty_tpl->tpl_vars['login']->value['ip_address'];?>
</code></td>
                                    <td><?php echo (($tmp = $_smarty_tpl->tpl_vars['login']->value['browser'] ?? null)===null||$tmp==='' ? '-' ?? null : $tmp);?>
 / <?php echo (($tmp = $_smarty_tpl->tpl_vars['login']->value['os'] ?? null)===null||$tmp==='' ? '-' ?? null : $tmp);?>
</td>
                                    <td>
                                        <?php if ($_smarty_tpl->tpl_vars['login']->value['success']) {?>
                                        <span class="badge bg-success">OK</span>
                                        <?php } else { ?>
                                        <span class="badge bg-danger">Błąd</span>
                                        <?php }?>
                                    </td>
                                    <td><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['login']->value['created_at'],"%d.%m.%Y %H:%M");?>
</td>
                                </tr>
                                <?php
}
if ($_smarty_tpl->tpl_vars['login']->do_else) {
?>
                                <tr>
                                    <td colspan="4" class="text-center py-3 text-muted">Brak historii logowań</td>
                                </tr>
                                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
}
}
/* {/block "content"} */
}
