show plan by nux-router

This commit is contained in:
Ibnu Maksum 2023-09-21 13:45:28 +07:00
parent c9eeefcf3d
commit 1832332d99
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 29 additions and 15 deletions

View File

@ -35,9 +35,19 @@ switch ($action) {
}
$ui->assign('_title', 'Order Plan');
$ui->assign('_system_menu', 'package');
$routers = ORM::for_table('tbl_routers')->find_many();
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Hotspot')->find_many();
if(!empty($_SESSION['nux-router'])){
$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('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('type', 'Hotspot')->find_many();
}else{
$routers = ORM::for_table('tbl_routers')->find_many();
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->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('plans_pppoe', $plans_pppoe);

View File

@ -31,6 +31,7 @@
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>ID</th>
<th>{$_L['Router_Name']}</th>
<th>{$_L['IP_Address']}</th>
<th>{$_L['Username']}</th>
@ -42,6 +43,7 @@
<tbody>
{foreach $d as $ds}
<tr {if $ds['enabled'] != 1}class="danger" title="disabled" {/if}>
<td>{$ds['id']}</td>
<td>{$ds['name']}</td>
<td>{$ds['ip_address']}</td>
<td>{$ds['username']}</td>
@ -50,7 +52,9 @@
<td>
<a href="{$_url}routers/edit/{$ds['id']}"
class="btn btn-info btn-xs">{$_L['Edit']}</a>
<a href="{$_url}routers/delete/{$ds['id']}" id="{$ds['id']}" onclick="return confirm('{$_L['Delete']}?')" class="btn btn-danger btn-xs">{$_L['Delete']}</a>
<a href="{$_url}routers/delete/{$ds['id']}" id="{$ds['id']}"
onclick="return confirm('{$_L['Delete']}?')"
class="btn btn-danger btn-xs">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}

View File

@ -6,13 +6,13 @@
<div class="box-header">{Lang::T('Order Internet Package')}</div>
</div>
{if $_c['enable_balance'] == 'yes'}
<div class="box box-solid box-primary">
<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">{$plan['name_plan']}</div>
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
@ -35,22 +35,22 @@
</div>
{/if}
{foreach $routers as $router}
{if Validator::isRouterHasPlan($plans_hotspot, $router['name'])>0 && Validator::isRouterHasPlan($plans_pppoe, $router['name'])>0}
<div class="box box-solid box-info">
<div class="box-header text-black">{$router['name']}</div>
{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>
{if $router['description'] != ''}
<div class="box-body">
{$router['description']}
</div>
{/if}
{if Validator::countRouterPlan($plans_hotspot, $router['name'])>0}
<div class="box-header">{Lang::T('Hotspot Plan')}</div>
<div class="box-header text-black">{Lang::T('Hotspot Plan')}</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-solid box-default">
<div class="box-header">{$plan['name_plan']}</div>
<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>
@ -93,13 +93,13 @@
</div>
{/if}
{if Validator::countRouterPlan($plans_pppoe,$router['name'])>0}
<div class="box-header text-sm">{Lang::T('PPPOE Plan')}</div>
<div class="box-header text-black">{Lang::T('PPPOE Plan')}</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-solid box-default">
<div class="box-header">{$plan['name_plan']}</div>
<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>