paginator dynamic

This commit is contained in:
Ibnu Maksum 2023-10-20 10:34:24 +07:00
parent 8cbe32e313
commit 7ebf95f4be
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
14 changed files with 352 additions and 216 deletions

View File

@ -8,6 +8,88 @@
class Paginator
{
public static function build($table, $colVal = [], $query='', $per_page = '10')
{
global $routes;
global $_L;
$url = U . implode('/', $routes);
$query = urlencode($query);
$adjacents = "2";
$page = (int)(empty(_get('p')) ? 1 : _get('p'));
$pagination = "";
foreach($colVal as $k=>$v) {
if(!empty($query)){
$table = $table->where_like($k, $v);
}else{
$table = $table->where($k, $v);
}
}
$totalReq = $table->count();
$page = ($page == 0 ? 1 : $page);
$next = $page + 1;
$lastpage = ceil($totalReq / $per_page);
$lpm1 = $lastpage - 1;
$limit = $per_page;
$startpoint = ($page * $limit) - $limit;
if ($lastpage >= 1) {
$pagination .= '<ul class="pagination pagination-sm">';
if ($lastpage < 7 + ($adjacents * 2)) {
for ($counter = 1; $counter <= $lastpage; $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a href='javascript:void(0);'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}&p=$counter&q=$query'>$counter</a></li>";
}
} elseif ($lastpage > 5 + ($adjacents * 2)) {
if ($page < 1 + ($adjacents * 2)) {
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a href='javascript:void(0);'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}&p=$counter&q=$query'>$counter</a></li>";
}
$pagination .= "<li class='disabled'><a href='#'>...</a></li>";
$pagination .= "<li><a href='{$url}&p=$lpm1&q=$query'>$lpm1</a></li>";
$pagination .= "<li><a href='{$url}&p=$lastpage&q=$query'>$lastpage</a></li>";
} elseif ($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) {
$pagination .= "<li><a href='{$url}&p=1&q=$query'>1</a></li>";
$pagination .= "<li><a href='{$url}&p=2&q=$query'>2</a></li>";
$pagination .= "<li class='disabled'><a href='#'>...</a></li>";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a href='javascript:void(0);'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}&p=$counter&q=$query'>$counter</a></li>";
}
$pagination .= "<li class='disabled'><a href='#'>...</a></li>";
$pagination .= "<li><a href='{$url}&p=$lpm1&q=$query'>$lpm1</a></li>";
$pagination .= "<li><a href='{$url}&p=$lastpage&q=$query'>$lastpage</a></li>";
} else {
$pagination .= "<li><a href='{$url}&p=1&q=$query'>1</a></li>";
$pagination .= "<li><a href='{$url}&p=2&q=$query'>2</a></li>";
$pagination .= "<li><a href='#'>...</a></li>";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a class='disabled'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}&p=$counter&q=$query'>$counter</a></li>";
}
}
}
if ($page < $counter - 1) {
$pagination .= "<li><a href='{$url}&p=$next&q=$query'>" . $_L['Next'] . "</a></li>";
$pagination .= "<li><a href='{$url}&p=$lastpage&q=$query'>" . $_L['Last'] . "</a></li>";
} else {
$pagination .= "<li class='disabled'><a class='disabled'>" . $_L['Next'] . "</a></li>";
$pagination .= "<li class='disabled'><a class='disabled'>" . $_L['Last'] . "</a></li>";
}
$pagination .= "</ul>";
return array("startpoint" => $startpoint, "limit" => $limit, "found" => $totalReq, "page" => $page, "lastpage" => $lastpage, "contents" => $pagination);
}
}
public static function bootstrap($table, $w1 = '', $c1 = '', $w2 = '', $c2 = '', $w3 = '', $c3 = '', $w4 = '', $c4 = '', $per_page = '10')
{
global $routes;
@ -17,16 +99,30 @@ class Paginator
$page = (int)(!isset($routes['2']) ? 1 : $routes['2']);
$pagination = "";
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->count();
} elseif ($w2 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->count();
} elseif ($w3 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count();
} elseif ($w4 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count();
} else {
$totalReq = ORM::for_table($table)->count();
if(is_object($table)){
if ($w1 != '') {
$totalReq = $table->where($w1, $c1)->count();
} elseif ($w2 != '') {
$totalReq = $table->where($w1, $c1)->where($w2, $c2)->count();
} elseif ($w3 != '') {
$totalReq = $table->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count();
} elseif ($w4 != '') {
$totalReq = $table->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count();
} else {
$totalReq = $table->count();
}
}else{
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->count();
} elseif ($w2 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->count();
} elseif ($w3 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count();
} elseif ($w4 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count();
} else {
$totalReq = ORM::for_table($table)->count();
}
}
$i = 0;
@ -109,11 +205,18 @@ class Paginator
$adjacents = "2";
$page = (int)(!isset($routes['2']) ? 1 : $routes['2']);
$pagination = "";
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where_raw($w1, $c1)->count();
} else {
$totalReq = ORM::for_table($table)->count();
if(is_object($table)){
if ($w1 != '') {
$totalReq = $table->where_raw($w1, $c1)->count();
} else {
$totalReq = $table->count();
}
}else{
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where_raw($w1, $c1)->count();
} else {
$totalReq = ORM::for_table($table)->count();
}
}
$i = 0;

View File

@ -20,43 +20,42 @@ if ($admin['user_type'] != 'Admin') {
switch ($action) {
case 'list':
$name = _post('name');
$q = (_post('q') ? _post('q') : _get('q'));
$keep = _post('keep');
if (!empty($keep)) {
ORM::raw_execute("DELETE FROM tbl_logs WHERE date < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL $keep DAY))");
r2(U . "logs/list/", 's', "Delete logs older than $keep days");
}
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_logs', 'description', '%' . $name . '%');
$d = ORM::for_table('tbl_logs')->where_like('description', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
if ($q != '') {
$paginator = Paginator::build(ORM::for_table('tbl_logs'), ['description' => '%' . $q . '%'], $q);
$d = ORM::for_table('tbl_logs')->where_like('description', '%' . $q . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_logs');
$paginator = Paginator::build(ORM::for_table('tbl_logs'));
$d = ORM::for_table('tbl_logs')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('name', $name);
$ui->assign('d', $d);
$ui->assign('q', $q);
$ui->assign('paginator', $paginator);
$ui->display('logs.tpl');
break;
case 'radius':
$name = _post('name');
$q = (_post('q') ? _post('q') : _get('q'));
$keep = _post('keep');
$page = (isset($routes['2']) ? intval($routes['2']) : 0);
$pageNow = $page * 20;
if (!empty($keep)) {
ORM::raw_execute("DELETE FROM radpostauth WHERE UNIX_TIMESTAMP(authdate) < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL $keep DAY))", [], 'radius');
r2(U . "logs/radius/", 's', "Delete logs older than $keep days");
}
if ($name != '') {
$d = ORM::for_table('radpostauth', 'radius')->where_like('username', '%' . $name . '%')->offset($pageNow)->limit(10)->order_by_desc('id')->find_many();
if ($q != '') {
$paginator = Paginator::build(ORM::for_table('radpostauth', 'radius'), ['username' => '%' . $q . '%'], $q);
$d = ORM::for_table('radpostauth', 'radius')->where_like('username', '%' . $q . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$d = ORM::for_table('radpostauth', 'radius')->offset($pageNow)->limit(10)->order_by_desc('id')->find_many();
$paginator = Paginator::build(ORM::for_table('radpostauth', 'radius'));
$d = ORM::for_table('radpostauth', 'radius')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('page', $page);
$ui->assign('name', $name);
$ui->assign('d', $d);
$ui->assign('q', $q);
$ui->assign('paginator', $paginator);
$ui->display('logs-radius.tpl');
break;

View File

@ -31,43 +31,51 @@ switch ($action) {
run_hook('customer_view_order_history'); #HOOK
$ui->display('user-orderHistory.tpl');
break;
case 'package':
if (strpos($user['email'], '@') === false) {
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));
}
$ui->assign('_title', 'Order Plan');
$ui->assign('_system_menu', 'package');
if (!empty($_SESSION['nux-router'])) {
if ($_SESSION['nux-router'] == 'radius') {
case 'balance':
if (strpos($user['email'], '@') === false) {
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));
}
$ui->assign('_title', 'Top Up');
$ui->assign('_system_menu', 'balance');
$plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many();
$ui->assign('plans_balance', $plans_balance);
$ui->display('user-orderBalance.tpl');
break;
case 'package':
if (strpos($user['email'], '@') === false) {
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));
}
$ui->assign('_title', 'Order Plan');
$ui->assign('_system_menu', 'package');
if (!empty($_SESSION['nux-router'])) {
if ($_SESSION['nux-router'] == 'radius') {
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->find_many();
} else {
$routers = ORM::for_table('tbl_routers')->where('id', $_SESSION['nux-router'])->find_many();
$rs = [];
foreach ($routers as $r) {
$rs[] = $r['name'];
}
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'Hotspot')->find_many();
}
} else {
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->find_many();
} else {
$routers = ORM::for_table('tbl_routers')->where('id', $_SESSION['nux-router'])->find_many();
$rs = [];
foreach ($routers as $r) {
$rs[] = $r['name'];
}
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'Hotspot')->find_many();
}
} else {
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->find_many();
$routers = ORM::for_table('tbl_routers')->find_many();
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'Hotspot')->find_many();
}
$plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many();
$ui->assign('routers', $routers);
$ui->assign('radius_pppoe', $radius_pppoe);
$ui->assign('radius_hotspot', $radius_hotspot);
$ui->assign('plans_pppoe', $plans_pppoe);
$ui->assign('plans_hotspot', $plans_hotspot);
$ui->assign('plans_balance', $plans_balance);
run_hook('customer_view_order_plan'); #HOOK
$ui->display('user-orderPlan.tpl');
break;
$routers = ORM::for_table('tbl_routers')->find_many();
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'Hotspot')->find_many();
}
$ui->assign('routers', $routers);
$ui->assign('radius_pppoe', $radius_pppoe);
$ui->assign('radius_hotspot', $radius_hotspot);
$ui->assign('plans_pppoe', $plans_pppoe);
$ui->assign('plans_hotspot', $plans_hotspot);
run_hook('customer_view_order_plan'); #HOOK
$ui->display('user-orderPlan.tpl');
break;
case 'unpaid':
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])

View File

@ -12,7 +12,19 @@ $action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
if(strpos($action,"-post")===false){
if(strpos($action,"-reset")!==false){
$action = str_replace("-reset","",$action);
$path = "pages/".str_replace(".","",$action).".html";
$temp = "pages_template/".str_replace(".","",$action).".html";
if(file_exists($temp)){
if(!copy($temp, $path)){
file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/'.$action.'.html'));
}
}else{
file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/'.$action.'.html'));
}
r2(U . 'pages/'.$action);
}else if(strpos($action,"-post")===false){
$path = "pages/".str_replace(".","",$action).".html";
//echo $path;
run_hook('view_edit_pages'); #HOOK

View File

@ -355,7 +355,7 @@ $_L['Invoice_Balance_Message'] = 'Invoice Balance Message';
$_L['Invoice_Notification_Payment'] = 'Invoice Notification Payment';
$_L['Balance_Notification_Payment'] = 'Balance Notification Payment';
$_L['Balance_Plans'] = 'Balance Plans';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Buy_Balance'] = 'Buy Balance';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';
@ -403,8 +403,8 @@ $_L['Deactivate'] = 'Deactivate';
$_L['Sync'] = 'Sync';
$_L['Failed_to_create_PaymeTrust_transaction'] = 'Failed to create PaymeTrust transaction.';
$_L['Location'] = 'Location';
$_L['Radius_Plans'] = 'Radius Plans';
$_L['Change_title_in_user_Plan_order'] = 'Change title in user Plan order';
$_L['Logs'] = 'Logs';
$_L['Voucher_Format'] = 'Voucher Format';
$_L['Resend_To_Customer'] = 'Resend To Customer';
$_L['Radius_Plans'] = 'Radius Plans';
$_L['Change_title_in_user_Plan_order'] = 'Change title in user Plan order';
$_L['Logs'] = 'Logs';
$_L['Voucher_Format'] = 'Voucher Format';
$_L['Resend_To_Customer'] = 'Resend To Customer';

View File

@ -355,7 +355,7 @@ $_L['User_Cannot_change_this_only_admin_if_it_Empty_it_will_use_user_password']
$_L['Invoice_Balance_Message'] = 'Invoice Balance Message';
$_L['Invoice_Notification_Payment'] = 'Invoice Notification Payment';
$_L['Balance_Notification_Payment'] = 'Balance Notification Payment';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Buy_Balance'] = 'Buy Balance';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';

View File

@ -354,7 +354,7 @@ $_L['User_Cannot_change_this_only_admin_if_it_Empty_it_will_use_user_password']
$_L['Invoice_Balance_Message'] = 'Invoice Balance Message';
$_L['Invoice_Notification_Payment'] = 'Invoice Notification Payment';
$_L['Balance_Notification_Payment'] = 'Balance Notification Payment';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Buy_Balance'] = 'Buy Balance';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';

View File

@ -330,7 +330,7 @@ $_L['Invoice_Balance_Message'] = 'Invoice Balance Message';
$_L['Invoice_Notification_Payment'] = 'Invoice Notification Payment';
$_L['Balance_Notification_Payment'] = 'Balance Notification Payment';
$_L['Balance_Plans'] = 'Balance Plans';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Buy_Balance'] = 'Buy Balance';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';

View File

@ -14,7 +14,7 @@
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control" value="{$name}"
<input type="text" name="q" class="form-control" value="{$q}"
placeholder="{$_L['Search_by_Name']}...">
<div class="input-group-btn">
<button class="btn btn-success" type="submit">{$_L['Search']}</button>
@ -53,16 +53,7 @@
</tbody>
</table>
</div>
<nav aria-label="...">
<ul class="pager">
{if $page > 0}
<li class="previous "><a href="{$_url}logs/radius/{$page-1}"><span
aria-hidden="true">&larr;</span> Newer</a></li>
{/if}
<li class="next"><a href="{$_url}logs/radius/{$page+1}">Older <span
aria-hidden="true">&rarr;</span></a></li>
</ul>
</nav>
{$paginator['contents']}
</div>
</div>
</div>

View File

@ -14,7 +14,7 @@
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control" value="{$name}"
<input type="text" name="q" class="form-control" value="{$q}"
placeholder="{$_L['Search_by_Name']}...">
<div class="input-group-btn">
<button class="btn btn-success" type="submit">{$_L['Search']}</button>

View File

@ -2,7 +2,13 @@
<div class="row">
<div class="col-sm-12">
<div class="panel mb20 panel-primary panel-hovered">
<div class="panel-heading">{$pageHeader}</div>
<div class="panel-heading">
<div class="btn-group pull-right">
<a class="btn btn-danger btn-xs" title="Reset File" href="{$_url}pages/{$PageFile}-reset" onclick="return confirm('Reset File?')"><span
class="glyphicon glyphicon-refresh" aria-hidden="true"></span></a>
</div>
{$pageHeader}
</div>
<div id="myNicPanel" style="width: 100%;"></div>
<div id="panel-edit" class="panel-body">{$htmls}</div>
{if $writeable}
@ -36,20 +42,20 @@
</form>
<script src="ui/ui/scripts/nicEdit.js"></script>
{literal}
<script type="text/javascript">
var myNicEditor
bkLib.onDomLoaded(function() {
myNicEditor = new nicEditor({fullPanel : true});
myNicEditor.setPanel('myNicPanel');
myNicEditor.addInstance('panel-edit');
});
<script type="text/javascript">
var myNicEditor
bkLib.onDomLoaded(function() {
myNicEditor = new nicEditor({fullPanel : true});
myNicEditor.setPanel('myNicPanel');
myNicEditor.addInstance('panel-edit');
});
function saveIt() {
//alert(document.getElementById('panel-edit').innerHTML);
document.getElementById('html').value = nicEditors.findEditor('panel-edit').getContent()
document.getElementById('formpages').submit();
}
</script>
function saveIt() {
//alert(document.getElementById('panel-edit').innerHTML);
document.getElementById('html').value = nicEditors.findEditor('panel-edit').getContent()
document.getElementById('formpages').submit();
}
</script>
{/literal}
{include file="sections/footer.tpl"}

View File

@ -125,6 +125,14 @@
</li>
{/if}
{if $_c['payment_gateway'] != 'none' or $_c['payment_gateway'] == '' }
{if $_c['enable_balance'] == 'yes'}
<li {if $_system_menu eq 'balance'}class="active" {/if}>
<a href="{$_url}order/balance">
<i class="ion ion-ios-cart"></i>
<span>{Lang::T('Buy Balance')}</span>
</a>
</li>
{/if}
<li {if $_system_menu eq 'package'}class="active" {/if}>
<a href="{$_url}order/package">
<i class="ion ion-ios-cart"></i>

View File

@ -0,0 +1,37 @@
{include file="sections/user-header.tpl"}
<!-- user-orderPlan -->
<div class="row">
<div class="col-sm-12">
{if $_c['enable_balance'] == 'yes'}
<div class="box box-solid box-success bg-gray-light">
<div class="box-header">{Lang::T('Balance Plans')}</div>
<div class="box-body row">
{foreach $plans_balance as $plan}
<div class="col col-md-4">
<div class="box box-solid box-default">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<a href="{$_url}order/buy/0/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy Balance')}?')"
class="btn btn-sm btn-block btn-primary">Buy</a>
</div>
</div>
</div>
{/foreach}
</div>
</div>
{/if}
</div>
</div>
</div>
{include file="sections/user-footer.tpl"}

View File

@ -5,153 +5,125 @@
<div class="box box-solid box-default">
<div class="box-header">{Lang::T('Order Internet Package')}</div>
</div>
{if $_c['enable_balance'] == 'yes'}
<div class="box box-solid box-success bg-gray-light">
<div class="box-header">{Lang::T('Balance Plans')}</div>
<div class="box-body row">
{foreach $plans_balance as $plan}
{if $_c['radius_enable']}
{if Lang::arrayCount($radius_hotspot)>0}
<ol class="breadcrumb">
<li>{if $_c['radius_plan']==''}Radius Plan{else}{$_c['radius_plan']}{/if}</li>
<li>{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}</li>
</ol>
<div class="row">
{foreach $radius_hotspot as $plan}
<div class="col col-md-4">
<div class="box box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Validity')}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/send/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this for friend account?')}')"
class="btn btn-sm btn-block btn-primary">{Lang::T('Buy for friend')}</a>
{/if}
</div>
</div>
</div>
{/foreach}
</div>
{/if}
{if Lang::arrayCount($radius_pppoe)>0}
<ol class="breadcrumb">
<li>{if $_c['radius_plan']==''}Radius Plan{else}{$_c['radius_plan']}{/if}</li>
<li>{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}</li>
</ol>
<div class="row">
{foreach $radius_pppoe as $plan}
<div class="col col-md-4">
<div class="box box-solid box-default">
<div class="box box- box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Validity')}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<a href="{$_url}order/buy/0/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy Balance?')}')"
class="btn btn-sm btn-block btn-primary">Buy</a>
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/send/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this for friend account?')}')"
class="btn btn-sm btn-block btn-primary">{Lang::T('Buy for friend')}</a>
{/if}
</div>
</div>
</div>
{/foreach}
</div>
</div>
{/if}
{if $_c['radius_enable']}
<div class="box box-solid box-info bg-gray-light">
<div class="box-header text-black text-bold">{if $_c['radius_plan']==''}Radius
Plan{else}{$_c['radius_plan']}
{/if}</div>
{if Lang::arrayCount($radius_hotspot)>0}
<div class="box-header text-black">{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}</div>
<div class="box-body row">
{foreach $radius_hotspot as $plan}
<div class="col col-md-4">
<div class="box box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Validity')}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/send/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this for friend account?')}')"
class="btn btn-sm btn-block btn-primary">{Lang::T('Buy for friend')}</a>
{/if}
</div>
</div>
</div>
{/foreach}
</div>
{/if}
{if Lang::arrayCount($radius_pppoe)>0}
<div class="box-header text-black">{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}</div>
<div class="box-body row">
{foreach $radius_pppoe as $plan}
<div class="col col-md-4">
<div class="box box- box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Validity')}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/send/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this for friend account?')}')"
class="btn btn-sm btn-block btn-primary">{Lang::T('Buy for friend')}</a>
{/if}
</div>
</div>
</div>
{/foreach}
</div>
{/if}
</div>
{/if}
{/if}
{foreach $routers as $router}
{if Validator::isRouterHasPlan($plans_hotspot, $router['name']) || Validator::isRouterHasPlan($plans_pppoe, $router['name'])}
<div class="box box-solid box-info bg-gray-light">
<div class="box-header text-black text-bold">{$router['name']}</div>
<div class="box box-solid box-primary bg-gray">
<div class="box-header text-white text-bold">{$router['name']}</div>
{if $router['description'] != ''}
<div class="box-body">
{$router['description']}
</div>
{/if}
{if Validator::countRouterPlan($plans_hotspot, $router['name'])>0}
<div class="box-header text-black">{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}</div>
<div class="box-header text-white">{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}</div>
<div class="box-body row">
{foreach $plans_hotspot as $plan}
{if $router['name'] eq $plan['routers']}
<div class="col col-md-4">
<div class="box box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="box-header text-center text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
@ -194,13 +166,13 @@
</div>
{/if}
{if Validator::countRouterPlan($plans_pppoe,$router['name'])>0}
<div class="box-header text-black">{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}</div>
<div class="box-header text-white">{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}</div>
<div class="box-body row">
{foreach $plans_pppoe as $plan}
{if $router['name'] eq $plan['routers']}
<div class="col col-md-4">
<div class="box box- box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="box-header text-bold text-center">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>