check if router has plan
This commit is contained in:
parent
c5b96df43f
commit
c9eeefcf3d
@ -299,4 +299,23 @@ class Validator
|
||||
return (bool)in_array($format, $formats);
|
||||
}
|
||||
|
||||
public static function countRouterPlan($plans, $router){
|
||||
$n = 0;
|
||||
foreach ($plans as $plan){
|
||||
if($plan['routers'] == $router){
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
return $n;
|
||||
}
|
||||
|
||||
public static function isRouterHasPlan($plans, $router){
|
||||
foreach ($plans as $plan){
|
||||
if($plan['routers'] == $router){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,112 +35,114 @@
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $routers as $router}
|
||||
<div class="box box-solid box-info">
|
||||
<div class="box-header text-black">{$router['name']}</div>
|
||||
{if $router['description'] != ''}
|
||||
<div class="box-body">
|
||||
{$router['description']}
|
||||
</div>
|
||||
{/if}
|
||||
{if count($plans_hotspot)>0}
|
||||
<div class="box-header">{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="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/{$router['id']}/{$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/{$router['id']}/{$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 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 $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-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="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/{$router['id']}/{$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/{$router['id']}/{$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/{$router['id']}/{$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>
|
||||
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
|
||||
<a href="{$_url}order/send/{$router['id']}/{$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>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{if count($plans_pppoe)>0}
|
||||
<div class="box-header text-sm">{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="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/{$router['id']}/{$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/{$router['id']}/{$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}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{if Validator::countRouterPlan($plans_pppoe,$router['name'])>0}
|
||||
<div class="box-header text-sm">{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="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/{$router['id']}/{$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/{$router['id']}/{$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/{$router['id']}/{$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>
|
||||
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
|
||||
<a href="{$_url}order/send/{$router['id']}/{$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>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user