<?php
/* Smarty version 4.5.3, created on 2026-02-21 10:44:45
  from '/var/www/html/kaptembwa/ui/ui_custom/admin/plan/active.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.3',
  'unifunc' => 'content_6999626dc26871_81992193',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '4504518c06ef1428ab48245287bc6210a3273eed' => 
    array (
      0 => '/var/www/html/kaptembwa/ui/ui_custom/admin/plan/active.tpl',
      1 => 1770489334,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:sections/header.tpl' => 1,
    'file:pagination.tpl' => 1,
    'file:sections/footer.tpl' => 1,
  ),
),false)) {
function content_6999626dc26871_81992193 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_subTemplateRender("file:sections/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>

<div class="row">
    <div class="col-sm-12">
        <div class="card border-0 shadow-sm rounded-3">
            <div class="card-header bg-primary bg-gradient text-white py-3 px-4">
                <div class="d-flex align-items-center justify-content-between flex-wrap gap-3">
                    <div class="d-flex align-items-center">
                        <div class="rounded-circle bg-white bg-opacity-25 d-flex align-items-center justify-content-center me-3" style="width: 45px; height: 45px;">
                            <i class="isax isax-people fs-4"></i>
                        </div>
                        <div>
                            <h5 class="mb-0 fw-semibold"><?php echo Lang::T('Active Customers');?>
</h5>
                            <small class="opacity-75">Manage customer subscriptions</small>
                        </div>
                    </div>
                    <?php if (in_array($_smarty_tpl->tpl_vars['_admin']->value['user_type'],array('SuperAdmin','Admin'))) {?>
                        <div class="btn-group">
                            <a class="btn btn-light btn-sm px-3" title="Sync customers" href="<?php echo Text::url('');?>
plan/sync"
                                onclick="return ask(this, '<?php echo Lang::T("This will sync dan send Customer active package to Mikrotik");?>
?')">
                                <i class="isax isax-refresh me-1"></i> <?php echo Lang::T("Sync");?>

                            </a>
                        </div>
                    <?php }?>
                </div>
            </div>
            <form id="site-search" method="post" action="<?php echo Text::url('');?>
plan/list/">
                <div class="card-body bg-light border-bottom">
                    <div class="row g-2">
                        <div class="col-lg-2">
                            <div class="input-group">
                                <a class="btn btn-outline-danger" title="Clear Search Query"
                                    href="<?php echo Text::url('');?>
plan/list">
                                    <i class="isax isax-close-circle"></i>
                                </a>
                                <input type="text" name="search" class="form-control"
                                    placeholder="<?php echo Lang::T("Search");?>
..." value="<?php echo $_smarty_tpl->tpl_vars['search']->value;?>
">
                            </div>
                        </div>
                        <div class="col-lg-2 col-xs-4">
                            <select class="form-select" id="router" name="router">
                                <option value=""><?php echo Lang::T("Location");?>
</option>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['routers']->value, 'r');
$_smarty_tpl->tpl_vars['r']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['r']->value) {
$_smarty_tpl->tpl_vars['r']->do_else = false;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['r']->value;?>
" <?php if ($_smarty_tpl->tpl_vars['router']->value == $_smarty_tpl->tpl_vars['r']->value) {?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['r']->value;?>
</option>
                                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                            </select>
                        </div>
                        <div class="col-lg-2 col-xs-4">
                            <select class="form-select" id="plan" name="plan">
                                <option value=""><?php echo Lang::T("Plan Name");?>
</option>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['plans']->value, 'p');
$_smarty_tpl->tpl_vars['p']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['p']->value) {
$_smarty_tpl->tpl_vars['p']->do_else = false;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['p']->value['id'];?>
" <?php if ($_smarty_tpl->tpl_vars['plan']->value == $_smarty_tpl->tpl_vars['p']->value['id']) {?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['p']->value['name_plan'];?>
</option>
                                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                            </select>
                        </div>
                        <div class="col-lg-2 col-xs-4">
                            <select class="form-select" id="status" name="status">
                                <option value="-"><?php echo Lang::T("Status");?>
</option>
                                <option value="on" <?php if ($_smarty_tpl->tpl_vars['status']->value == 'on') {?>selected<?php }?>><?php echo Lang::T("Active");?>
</option>
                                <option value="off" <?php if ($_smarty_tpl->tpl_vars['status']->value == 'off') {?>selected<?php }?>><?php echo Lang::T("Expired");?>
</option>
                            </select>
                        </div>
                        <div class="col-md-2 col-xs-6">
                            <button class="btn btn-success w-100" type="submit">
                                <i class="isax isax-search-normal-1 me-1"></i> <?php echo Lang::T("Search");?>

                            </button>
                        </div>
                        <div class="col-md-2 col-xs-6">
                            <a href="<?php echo Text::url('');?>
plan/recharge" class="btn btn-primary w-100">
                                <i class="isax isax-add-circle me-1"></i><?php echo Lang::T("Recharge Account");?>

                            </a>
                        </div>
                    </div>
                </div>
            </form>
            <div class="table-responsive">
                    <table id="datatable" class="table table-hover align-middle mb-0">
                        <thead class="bg-light">
                            <tr>
                                <th class="py-3 fw-semibold">
                                    <i class="isax isax-user me-1 text-primary"></i><?php echo Lang::T("Username");?>

                                </th>
                                <th class="py-3 fw-semibold">
                                    <i class="isax isax-box me-1 text-primary"></i><?php echo Lang::T("Plan Name");?>

                                </th>
                                <th class="py-3 fw-semibold">
                                    <i class="isax isax-category me-1 text-primary"></i><?php echo Lang::T("Type");?>

                                </th>
                                <th class="py-3 fw-semibold">
                                    <i class="isax isax-calendar-add me-1 text-primary"></i><?php echo Lang::T("Created On");?>

                                </th>
                                <th class="py-3 fw-semibold">
                                    <i class="isax isax-calendar-remove me-1 text-primary"></i><?php echo Lang::T("Expires On");?>

                                </th>
                                <th class="py-3 fw-semibold">
                                    <i class="isax isax-wallet-money me-1 text-primary"></i><?php echo Lang::T("Method");?>

                                </th>
                                <th class="py-3 fw-semibold">
                                    <i class="isax isax-location me-1 text-primary"></i><a href="<?php echo Text::url('');?>
routers/list" class="text-decoration-none text-dark"><?php echo Lang::T("Location");?>
</a>
                                </th>
                                <th class="py-3 fw-semibold text-center">
                                    <i class="isax isax-setting-2 me-1 text-primary"></i><?php echo Lang::T("Manage");?>

                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['d']->value, 'ds');
$_smarty_tpl->tpl_vars['ds']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['ds']->value) {
$_smarty_tpl->tpl_vars['ds']->do_else = false;
?>
                                <tr <?php if ($_smarty_tpl->tpl_vars['ds']->value['status'] == 'off') {?>class="table-danger" <?php }?>>
                                    <td class="py-3">
                                        <div class="d-flex align-items-center">
                                            <div class="rounded-circle bg-primary bg-opacity-10 d-flex align-items-center justify-content-center me-2" style="width: 32px; height: 32px;">
                                                <i class="isax isax-user text-primary" style="font-size: 14px;"></i>
                                            </div>
                                            <?php if ($_smarty_tpl->tpl_vars['ds']->value['customer_id'] == '0') {?>
                                                <a class="text-decoration-none fw-medium"
                                                    href="<?php echo Text::url('plan/voucher/&search=');
echo $_smarty_tpl->tpl_vars['ds']->value['username'];?>
"><?php echo $_smarty_tpl->tpl_vars['ds']->value['username'];?>
</a>
                                            <?php } else { ?>
                                                <a class="text-decoration-none fw-medium" href="<?php echo Text::url('customers/viewu/');
echo $_smarty_tpl->tpl_vars['ds']->value['username'];?>
"><?php echo $_smarty_tpl->tpl_vars['ds']->value['username'];?>
</a>
                                            <?php }?>
                                        </div>
                                    </td>
                                    <td class="py-3">
                                        <?php if ($_smarty_tpl->tpl_vars['ds']->value['type'] == 'Hotspot') {?>
                                            <a class="text-decoration-none" href="<?php echo Text::url('');?>
services/edit/<?php echo $_smarty_tpl->tpl_vars['ds']->value['plan_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['ds']->value['namebp'];?>
</a>
                                            <span
                                                api-get-text="<?php echo Text::url('');?>
autoload/customer_is_active/<?php echo $_smarty_tpl->tpl_vars['ds']->value['username'];?>
/<?php echo $_smarty_tpl->tpl_vars['ds']->value['plan_id'];?>
"></span>
                                        <?php } elseif ($_smarty_tpl->tpl_vars['ds']->value['type'] == 'PPPOE') {?>
                                            <a class="text-decoration-none" href="<?php echo Text::url('');?>
services/pppoe-edit/<?php echo $_smarty_tpl->tpl_vars['ds']->value['plan_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['ds']->value['namebp'];?>
</a>
                                            <span
                                                api-get-text="<?php echo Text::url('');?>
autoload/customer_is_active/<?php echo $_smarty_tpl->tpl_vars['ds']->value['username'];?>
/<?php echo $_smarty_tpl->tpl_vars['ds']->value['plan_id'];?>
"></span>
                                        <?php } elseif ($_smarty_tpl->tpl_vars['ds']->value['type'] == 'VPN') {?>
                                            <a class="text-decoration-none" href="<?php echo Text::url('');?>
services/vpn-edit/<?php echo $_smarty_tpl->tpl_vars['ds']->value['plan_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['ds']->value['namebp'];?>
</a>
                                        <?php }?>
                                    </td>
                                    <td class="py-3">
                                        <span class="badge bg-info bg-opacity-10 text-info px-2 py-1"><?php echo $_smarty_tpl->tpl_vars['ds']->value['type'];?>
</span>
                                    </td>
                                    <td class="py-3">
                                        <small class="text-muted"><?php echo Lang::dateAndTimeFormat($_smarty_tpl->tpl_vars['ds']->value['recharged_on'],$_smarty_tpl->tpl_vars['ds']->value['recharged_time']);?>
</small>
                                    </td>
                                    <td class="py-3">
                                        <small class="text-muted"><?php echo Lang::dateAndTimeFormat($_smarty_tpl->tpl_vars['ds']->value['expiration'],$_smarty_tpl->tpl_vars['ds']->value['time']);?>
</small>
                                    </td>
                                    <td class="py-3">
                                        <span class="badge bg-success bg-opacity-10 text-success px-2 py-1"><?php echo $_smarty_tpl->tpl_vars['ds']->value['method'];?>
</span>
                                    </td>
                                    <td class="py-3">
                                        <span class="badge bg-warning bg-opacity-10 text-warning px-2 py-1"><?php echo $_smarty_tpl->tpl_vars['ds']->value['routers'];?>
</span>
                                    </td>
                                    <td class="py-3 text-center">
                                        <div class="btn-group btn-group-sm" role="group">
                                            <a href="<?php echo Text::url('');?>
plan/edit/<?php echo $_smarty_tpl->tpl_vars['ds']->value['id'];?>
" class="btn btn-warning" title="Edit">
                                                <i class="isax isax-edit-2"></i>
                                            </a>
                                            <?php if (in_array($_smarty_tpl->tpl_vars['_admin']->value['user_type'],array('SuperAdmin','Admin'))) {?>
                                                <a href="<?php echo Text::url('');?>
plan/delete/<?php echo $_smarty_tpl->tpl_vars['ds']->value['id'];?>
" id="<?php echo $_smarty_tpl->tpl_vars['ds']->value['id'];?>
"
                                                    onclick="return ask(this, '<?php echo Lang::T("Delete");?>
?')"
                                                    class="btn btn-danger" title="Delete">
                                                    <i class="isax isax-trash"></i>
                                                </a>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['ds']->value['status'] == 'off' && $_smarty_tpl->tpl_vars['_c']->value['extend_expired']) {?>
                                                <a href="javascript:extend('<?php echo $_smarty_tpl->tpl_vars['ds']->value['id'];?>
')"
                                                    class="btn btn-info" title="Extend">
                                                    <i class="isax isax-timer-start"></i>
                                                </a>
                                            <?php }?>
                                        </div>
                                    </td>
                                </tr>
                            <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                        </tbody>
                    </table>
                </div>
            </div>
            <?php $_smarty_tpl->_subTemplateRender("file:pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>
        </div>
    </div>
</div>

<?php echo '<script'; ?>
>
    function extend(idP) {
        var res = prompt("Extend for many days?", "3");
        if (res) {
            if (confirm("Extend for " + res + " days?")) {
                window.location.href = "<?php echo Text::url('plan/extend/');?>
" + idP + "/" + res + "<?php echo Text::isQA('? or &');?>
stoken=<?php echo App::getToken();?>
";
            }
        }
    }
<?php echo '</script'; ?>
>

<?php $_smarty_tpl->_subTemplateRender("file:sections/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
}
}
