<?php
/* Smarty version 4.5.6, created on 2025-12-21 09:51:44
  from '/var/www/html/tivi/panel/templates/admin/backups.tpl' */

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


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

<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl, "layout.tpl");
}
/* {block "content"} */
class Block_16783008826947b5208428f4_93609886 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content' => 
  array (
    0 => 'Block_16783008826947b5208428f4_93609886',
  ),
);
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.number_format.php','function'=>'smarty_modifier_number_format',),1=>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">Kopie zapasowe</h4>
            <p class="text-muted mb-0">Zarządzaj backupami bazy danych</p>
        </div>
        <form method="post" action="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/admin/tools/backup">
            <input type="hidden" name="csrf_token" value="<?php echo $_smarty_tpl->tpl_vars['csrfToken']->value;?>
">
            <button type="submit" class="btn btn-primary">
                <i class="bi bi-plus-lg me-1"></i>Utwórz backup
            </button>
        </form>
    </div>

    <div class="card">
        <div class="card-body p-0">
            <div class="table-responsive">
                <table class="table table-hover mb-0">
                    <thead>
                        <tr>
                            <th>Nazwa pliku</th>
                            <th>Rozmiar</th>
                            <th>Data utworzenia</th>
                            <th class="text-end">Akcje</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['backups']->value, 'backup');
$_smarty_tpl->tpl_vars['backup']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['backup']->value) {
$_smarty_tpl->tpl_vars['backup']->do_else = false;
?>
                        <tr>
                            <td>
                                <i class="bi bi-file-earmark-zip me-2 text-muted"></i>
                                <strong><?php echo $_smarty_tpl->tpl_vars['backup']->value['name'];?>
</strong>
                            </td>
                            <td><?php echo smarty_modifier_number_format(($_smarty_tpl->tpl_vars['backup']->value['size']/1048576),2);?>
 MB</td>
                            <td><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['backup']->value['created'],"%d.%m.%Y %H:%M:%S");?>
</td>
                            <td class="text-end">
                                <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/admin/backups/download?file=<?php echo rawurlencode((string)$_smarty_tpl->tpl_vars['backup']->value['name']);?>
" 
                                   class="btn btn-sm btn-outline-primary" title="Pobierz">
                                    <i class="bi bi-download"></i>
                                </a>
                                <form method="post" action="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/admin/backups/delete" class="d-inline">
                                    <input type="hidden" name="csrf_token" value="<?php echo $_smarty_tpl->tpl_vars['csrfToken']->value;?>
">
                                    <input type="hidden" name="file" value="<?php echo $_smarty_tpl->tpl_vars['backup']->value['name'];?>
">
                                    <button type="submit" class="btn btn-sm btn-outline-danger" title="Usuń" 
                                            onclick="return confirm('Usunąć ten backup?')">
                                        <i class="bi bi-trash"></i>
                                    </button>
                                </form>
                            </td>
                        </tr>
                        <?php
}
if ($_smarty_tpl->tpl_vars['backup']->do_else) {
?>
                        <tr>
                            <td colspan="4" class="text-center py-5 text-muted">
                                <i class="bi bi-archive fs-1 d-block mb-3"></i>
                                Brak kopii zapasowych
                            </td>
                        </tr>
                        <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="alert alert-info mt-4">
        <i class="bi bi-info-circle me-2"></i>
        System automatycznie przechowuje ostatnie 7 backupów. Starsze są usuwane automatycznie.
    </div>
</div>
<?php
}
}
/* {/block "content"} */
}
