<?php
/* Smarty version 4.5.6, created on 2025-12-14 13:09:32
  from '/var/www/html/tivi/panel/templates/playlists/clone.tpl' */

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


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

<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl, "layout.tpl");
}
/* {block "content"} */
class Block_491265878693ea8fcd08609_43188004 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content' => 
  array (
    0 => 'Block_491265878693ea8fcd08609_43188004',
  ),
);
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.truncate.php','function'=>'smarty_modifier_truncate',),));
?>

<div class="container-fluid">
    <div class="row justify-content-center">
        <div class="col-lg-6">
            <!-- Header -->
            <div class="d-flex justify-content-between align-items-center mb-4">
                <div>
                    <h4 class="mb-1">Sklonuj playlistę</h4>
                    <p class="text-muted mb-0">Skopiuj playlistę do innego urządzenia</p>
                </div>
                <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/playlists?device_id=<?php echo $_smarty_tpl->tpl_vars['playlist']->value['device_id'];?>
" class="btn btn-outline-secondary">
                    <i class="bi bi-arrow-left me-1"></i>Powrót
                </a>
            </div>

            <!-- Info o źródłowej playliście -->
            <div class="card mb-4">
                <div class="card-header">
                    <h6 class="mb-0">
                        <?php if ($_smarty_tpl->tpl_vars['playlist']->value['type'] == 'xtream') {?>
                        <i class="bi bi-broadcast text-primary me-2"></i>
                        <?php } elseif ($_smarty_tpl->tpl_vars['playlist']->value['type'] == 'm3u') {?>
                        <i class="bi bi-link-45deg text-success me-2"></i>
                        <?php } else { ?>
                        <i class="bi bi-hdd-network text-warning me-2"></i>
                        <?php }?>
                        Playlista źródłowa
                    </h6>
                </div>
                <div class="card-body">
                    <table class="table table-sm mb-0">
                        <tr>
                            <th class="text-muted" style="width: 35%">Nazwa:</th>
                            <td><strong><?php echo $_smarty_tpl->tpl_vars['playlist']->value['name'];?>
</strong></td>
                        </tr>
                        <tr>
                            <th class="text-muted">Typ:</th>
                            <td>
                                <span class="badge <?php if ($_smarty_tpl->tpl_vars['playlist']->value['type'] == 'xtream') {?>bg-primary<?php } elseif ($_smarty_tpl->tpl_vars['playlist']->value['type'] == 'm3u') {?>bg-success<?php } else { ?>bg-warning<?php }?>">
                                    <?php echo mb_strtoupper((string) $_smarty_tpl->tpl_vars['playlist']->value['type'] ?? '', 'UTF-8');?>

                                </span>
                            </td>
                        </tr>
                        <tr>
                            <th class="text-muted">Urządzenie:</th>
                            <td><?php echo (($tmp = $_smarty_tpl->tpl_vars['playlist']->value['device_name'] ?? null)===null||$tmp==='' ? $_smarty_tpl->tpl_vars['playlist']->value['mac'] ?? null : $tmp);?>
</td>
                        </tr>
                        <?php if ($_smarty_tpl->tpl_vars['playlist']->value['type'] == 'xtream') {?>
                        <tr>
                            <th class="text-muted">Host:</th>
                            <td><code><?php echo $_smarty_tpl->tpl_vars['config']->value['host'];?>
</code></td>
                        </tr>
                        <tr>
                            <th class="text-muted">User:</th>
                            <td><code><?php echo $_smarty_tpl->tpl_vars['config']->value['username'];?>
</code></td>
                        </tr>
                        <?php } elseif ($_smarty_tpl->tpl_vars['playlist']->value['type'] == 'm3u') {?>
                        <tr>
                            <th class="text-muted">URL:</th>
                            <td><code class="small"><?php echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['config']->value['url'],50);?>
</code></td>
                        </tr>
                        <?php } else { ?>
                        <tr>
                            <th class="text-muted">Server:</th>
                            <td><code><?php echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['config']->value['server_url'],40);?>
</code></td>
                        </tr>
                        <tr>
                            <th class="text-muted">MAC:</th>
                            <td><code><?php echo $_smarty_tpl->tpl_vars['config']->value['mac_address'];?>
</code></td>
                        </tr>
                        <?php }?>
                    </table>
                </div>
            </div>

            <!-- Formularz wyboru urządzenia docelowego -->
            <div class="card">
                <div class="card-header">
                    <h6 class="mb-0"><i class="bi bi-arrow-right-circle me-2"></i>Urządzenie docelowe</h6>
                </div>
                <div class="card-body">
                    <?php if ((($tmp = $_smarty_tpl->tpl_vars['error']->value ?? null)===null||$tmp==='' ? false ?? null : $tmp)) {?>
                    <div class="alert alert-danger">
                        <i class="bi bi-exclamation-circle me-2"></i><?php echo $_smarty_tpl->tpl_vars['error']->value;?>

                    </div>
                    <?php }?>

                    <form method="post" action="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/playlists/clone?id=<?php echo $_smarty_tpl->tpl_vars['playlist']->value['id'];?>
">
                        <input type="hidden" name="csrf_token" value="<?php echo $_smarty_tpl->tpl_vars['csrfToken']->value;?>
">

                        <div class="mb-4">
                            <label class="form-label">Wybierz urządzenie <span class="text-danger">*</span></label>
                            <select name="device_id" class="form-select" required>
                                <option value="">Wybierz urządzenie...</option>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['devices']->value, 'device');
$_smarty_tpl->tpl_vars['device']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['device']->value) {
$_smarty_tpl->tpl_vars['device']->do_else = false;
?>
                                <?php if ($_smarty_tpl->tpl_vars['device']->value['id'] != $_smarty_tpl->tpl_vars['playlist']->value['device_id']) {?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['device']->value['id'];?>
">
                                    <?php echo (($tmp = $_smarty_tpl->tpl_vars['device']->value['name'] ?? null)===null||$tmp==='' ? $_smarty_tpl->tpl_vars['device']->value['mac'] ?? null : $tmp);?>
 
                                    (<?php echo $_smarty_tpl->tpl_vars['device']->value['mac'];?>
)
                                    <?php if ($_smarty_tpl->tpl_vars['isAdmin']->value && $_smarty_tpl->tpl_vars['device']->value['username']) {?> - <?php echo $_smarty_tpl->tpl_vars['device']->value['username'];
}?>
                                </option>
                                <?php }?>
                                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                            </select>
                            <small class="text-muted">Playlista zostanie skopiowana do wybranego urządzenia</small>
                        </div>

                        <div class="alert alert-info mb-4">
                            <i class="bi bi-info-circle me-2"></i>
                            Jeśli na urządzeniu docelowym istnieje już playlista o tej samej nazwie, zostanie automatycznie dodana numeracja.
                            Jeśli istnieje playlista z identycznymi danymi (URL/host), klonowanie nie będzie możliwe.
                        </div>

                        <div class="d-grid">
                            <button type="submit" class="btn btn-primary btn-lg">
                                <i class="bi bi-copy me-2"></i>Sklonuj playlistę
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
}
}
/* {/block "content"} */
}
