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('_title', 'Order Plan');
$ui->assign('_system_menu', 'package'); $ui->assign('_system_menu', 'package');
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(); $routers = ORM::for_table('tbl_routers')->find_many();
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'PPPOE')->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_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(); $plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many();
$ui->assign('routers', $routers); $ui->assign('routers', $routers);
$ui->assign('plans_pppoe', $plans_pppoe); $ui->assign('plans_pppoe', $plans_pppoe);

View File

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

View File

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