add new feature "service type" Hotspot PPPoE and Others

ability to display packages according to the user type.
Hotspot users Can now see only hotspot packages
PPPoE users can now see only PPPoE Packages
Others Can see both Hotspot and PPPoE packages
This commit is contained in:
Focuslinkstech 2023-12-14 03:21:55 +01:00
parent 9190660c1c
commit a7a0f84df5
9 changed files with 480 additions and 279 deletions

View File

@ -27,6 +27,7 @@ CREATE TABLE `tbl_customers` (
`phonenumber` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
`email` varchar(128) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1',
`balance` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'For Money Deposit',
`service_type` ENUM('Hotspot','PPPoE','Others') DEFAULT 'Others' COMMENT 'For selecting user type',
`auto_renewal` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Auto renewall using balance',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_login` datetime DEFAULT NULL

View File

@ -28,7 +28,8 @@ switch ($action) {
'username' => '%' . $search . '%',
'fullname' => '%' . $search . '%',
'phonenumber' => '%' . $search . '%',
'email' => '%' . $search . '%'
'email' => '%' . $search . '%',
'service_type' => '%' . $search . '%'
], $search);
$d = ORM::for_table('tbl_customers')
->where_raw("(`username` LIKE '%$search%' OR `fullname` LIKE '%$search%' OR `phonenumber` LIKE '%$search%' OR `email` LIKE '%$search%')", [$search, $search, $search, $search])
@ -225,8 +226,9 @@ switch ($action) {
$password = _post('password');
$pppoe_password = _post('pppoe_password');
$email = _post('email');
$address = _post('address');
$address = _post('address');
$phonenumber = _post('phonenumber');
$service_type = _post('service_type');
run_hook('add_customer'); #HOOK
$msg = '';
if (Validator::Length($username, 35, 2) == false) {
@ -253,6 +255,7 @@ switch ($action) {
$d->fullname = $fullname;
$d->address = $address;
$d->phonenumber = Lang::phoneFormat($phonenumber);
$d->service_type = $service_type;
$d->save();
r2(U . 'customers/list', 's', $_L['account_created_successfully']);
} else {
@ -268,6 +271,7 @@ switch ($action) {
$email = _post('email');
$address = _post('address');
$phonenumber = Lang::phoneFormat(_post('phonenumber'));
$service_type = _post('service_type');
run_hook('edit_customer'); #HOOK
$msg = '';
if (Validator::Length($username, 16, 2) == false) {
@ -320,6 +324,7 @@ switch ($action) {
$d->email = $email;
$d->address = $address;
$d->phonenumber = $phonenumber;
$d->service_type = $service_type;
$d->save();
if ($userDiff || $pppoeDiff || $passDiff) {
$c = ORM::for_table('tbl_user_recharges')->where('username', ($userDiff) ? $oldusername : $username)->find_one();

View File

@ -35,5 +35,8 @@
],
"2023.10.24" : [
"ALTER TABLE `nas` ADD `routers` VARCHAR(32) NOT NULL DEFAULT '' AFTER `description`;"
],
"2023.12.15": [
"ALTER TABLE `tbl_customers` ADD `service_type` ENUM('Hotspot','PPPoE','Others') DEFAULT 'Others' COMMENT 'For selecting user type' AFTER `balance`;"
]
}

View File

@ -72,6 +72,16 @@
<textarea name="address" id="address" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Service Type')}</label>
<div class="col-md-6">
<select class="form-control" id="service_type" name="service_type">
<option value="Hotspot" {if $d['service_type'] eq 'Hotspot'}selected{/if}>Hotspot</option>
<option value="PPPoE" {if $d['service_type'] eq 'PPPoE'}selected{/if}>PPPoE</option>
<option value="Others" {if $d['service_type'] eq 'Others'}selected{/if}>Others</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">

View File

@ -77,6 +77,16 @@
<textarea name="address" id="address" class="form-control">{$d['address']}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Service Type')}</label>
<div class="col-md-6">
<select class="form-control" id="service_type" name="service_type">
<option value="Hotspot" {if $d['service_type'] eq 'Hotspot'}selected{/if}>Hotspot</option>
<option value="PPPoE" {if $d['service_type'] eq 'PPPoE'}selected{/if}>PPPoE</option>
<option value="Others" {if $d['service_type'] eq 'Others'}selected{/if}>Others</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">

View File

@ -37,6 +37,9 @@
onclick="this.select()">
</li>
{/if}
<li class="list-group-item">
<b>{Lang::T('Service Type')}</b> <span class="pull-right">{Lang::T($d['service_type'])}</span>
</li>
<li class="list-group-item">
<b>{Lang::T('Balance')}</b> <span class="pull-right">{Lang::moneyFormat($d['balance'])}</span>
</li>

View File

@ -33,6 +33,7 @@
<th>{$_L['Phone_Number']}</th>
<th>{$_L['Email']}</th>
<th>{$_L['Package']}</th>
<th>{Lang::T('Service Type')}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Manage']}</th>
</tr>
@ -48,6 +49,7 @@
<td align="center" api-get-text="{$_url}autoload/customer_is_active/{$ds['id']}">
<span class="label label-default">&bull;</span>
</td>
<td>{$ds['service_type']}</td>
<td>{Lang::dateTimeFormat($ds['created_at'])}</td>
<td align="center">
<a href="{$_url}customers/view/{$ds['id']}" id="{$ds['id']}" style="margin: 0px;"

View File

@ -8,7 +8,7 @@
<div class="box-header">
<h3 class="box-title">{Lang::T('Unpaid Order')}</h3>
</div>
<table class="table table-condensed table-bordered table-striped table-hover">
<table class="table table-condensed table-bordered table-striped table-hover" style="margin-bottom: 0px;">
<tbody>
<tr>
<td>{Lang::T('expired')}</td>
@ -62,7 +62,8 @@
<div class="box-header">
<h3 class="box-title">{$_L['Account_Information']}</h3>
</div>
<table class="table table-bordered table-striped table-bordered table-hover">
<table class="table table-bordered table-striped table-bordered table-hover mb-0"
style="margin-bottom: 0px;">
<tr>
<td class="small text-success text-uppercase text-normal">{$_L['Username']}</td>
<td class="small mb15">{$_user['username']}</td>
@ -73,6 +74,11 @@
style="width:100%; border: 0px;" onmouseleave="this.type = 'password'"
onmouseenter="this.type = 'text'" onclick="this.select()"></td>
</tr>
<tr>
<td class="small text-success text-uppercase text-normal">{Lang::T('Service Type')}</td>
<td class="small mb15">{$_user['service_type']}</td>
</tr>
{if $_c['enable_balance'] == 'yes'}
<tr>
<td class="small text-warning text-uppercase text-normal">{Lang::T('Balance')}</td>
@ -88,84 +94,95 @@
</td>
</tr>
{/if}
{if $_bill}
</table>
{if $_bills}
{foreach $_bills as $_bill}
{if $_bill['routers'] != 'radius'}
<tr>
<td class="small text-primary text-uppercase text-normal">{strtoupper(Lang::T('Location'))}</td>
<td class="small mb15">{$_bill['routers']}</td>
</tr>
<div class="box-header">
<h3 class="box-title">{$_bill['routers']}</h3>
</div>
{else}
<div class="box-header">
<h3 class="box-title">{if $_c['radius_plan']==''}Radius Plan{else}{$_c['radius_plan']}{/if}</h3>
</div>
{/if}
<tr>
<td class="small text-primary text-uppercase text-normal">{$_L['Plan_Name']}</td>
<td class="small mb15">
{$_bill['namebp']}
{if $_bill['status'] == 'on'}
<a class="label label-danger pull-right" href="{$_url}home&deactivate=1"
onclick="return confirm('{Lang::T('Deactivate')}?')">{Lang::T('Deactivate')}</a>
{else}
<a class="label label-warning pull-right" href="{$_url}order/package">{Lang::T('expired')}</a>
{/if}
</td>
</tr>
<tr>
<td class="small text-info text-uppercase text-normal">{$_L['Created_On']}</td>
<td class="small mb15">
{if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['recharged_on'],$_bill['recharged_time'])}
{/if}&nbsp;</td>
</tr>
<tr>
<td class="small text-danger text-uppercase text-normal">{$_L['Expires_On']}</td>
<td class="small mb15 text-danger">
{if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['expiration'],$_bill['time'])}{/if}&nbsp;
<a class="label label-primary pull-right" href="{$_url}home&recharge=1"
onclick="return confirm('{Lang::T('Recharge')}?')">{Lang::T('Recharge')}</a>
</td>
</tr>
{if $nux_ip}
<table class="table table-bordered table-striped table-bordered table-hover" style="margin-bottom: 0px;">
<tr>
<td class="small text-primary text-uppercase text-normal">{Lang::T('Current IP')}</td>
<td class="small mb15">{$nux_ip}</td>
</tr>
{/if}
{if $nux_mac}
<tr>
<td class="small text-primary text-uppercase text-normal">{Lang::T('Current MAC')}</td>
<td class="small mb15">{$nux_mac}</td>
</tr>
{/if}
{if $_bill['type'] == 'Hotspot' && $_bill['status'] == 'on' && $_bill['routers'] != 'radius'}
<tr>
<td class="small text-primary text-uppercase text-normal">{Lang::T('Login Status')}</td>
<td class="small mb15" id="login_status">
<img src="ui/ui/images/loading.gif">
<td class="small text-primary text-uppercase text-normal">{$_L['Plan_Name']}</td>
<td class="small mb15">
{$_bill['namebp']}
{if $_bill['status'] == 'on'}
<a class="label label-danger pull-right" href="{$_url}home&deactivate={$_bill['id']}"
onclick="return confirm('{Lang::T('Deactivate')}?')">{Lang::T('Deactivate')}</a>
{else}
<a class="label label-warning pull-right" href="{$_url}order/package">{Lang::T('expired')}</a>
{/if}
</td>
</tr>
{/if}
{/if}
</table>
{if $_c['disable_voucher'] == 'yes'}
<div class="box-footer">
{if $_c['payment_gateway'] != 'none' or $_c['payment_gateway'] == '' }
<a href="{$_url}order/package" class="btn btn-primary btn-block">
<i class="ion ion-ios-cart"></i>
{Lang::T('Order Package')}
</a>
{/if}
</div>
<tr>
<td class="small text-info text-uppercase text-normal">{$_L['Created_On']}</td>
<td class="small mb15">
{if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['recharged_on'],$_bill['recharged_time'])}
{/if}&nbsp;</td>
</tr>
<tr>
<td class="small text-danger text-uppercase text-normal">{$_L['Expires_On']}</td>
<td class="small mb15 text-danger">
{if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['expiration'],$_bill['time'])}{/if}&nbsp;
<a class="label label-primary pull-right" href="{$_url}home&recharge={$_bill['id']}"
onclick="return confirm('{Lang::T('Recharge')}?')">{Lang::T('Recharge')}</a>
</td>
</tr>
{if $nux_ip}
<tr>
<td class="small text-primary text-uppercase text-normal">{Lang::T('Current IP')}</td>
<td class="small mb15">{$nux_ip}</td>
</tr>
{/if}
{if $nux_mac}
<tr>
<td class="small text-primary text-uppercase text-normal">{Lang::T('Current MAC')}</td>
<td class="small mb15">{$nux_mac}</td>
</tr>
{/if}
{if $_bill['type'] == 'Hotspot' && $_bill['status'] == 'on' && $_bill['routers'] != 'radius'}
<tr>
<td class="small text-primary text-uppercase text-normal">{Lang::T('Login Status')}</td>
<td class="small mb15" id="login_status_{$_bill['id']}">
<img src="ui/ui/images/loading.gif">
</td>
</tr>
{/if}
</table>
{/foreach}
{/if}
</div>
{if $_bill['type'] == 'Hotspot' && $_bill['status'] == 'on'}
<script>
setTimeout(() => {
$.ajax({
url: "index.php?_route=autoload_user/isLogin",
cache: false,
success: function(msg) {
$("#login_status").html(msg);
}
});
}, 2000);
</script>
{if $_c['disable_voucher'] == 'yes'}
<div class="box-footer">
{if $_c['payment_gateway'] != 'none' or $_c['payment_gateway'] == '' }
<a href="{$_url}order/package" class="btn btn-primary btn-block">
<i class="ion ion-ios-cart"></i>
{Lang::T('Order Package')}
</a>
{/if}
</div>
{/if}
{if $_bills}
{foreach $_bills as $_bill}
{if $_bill['type'] == 'Hotspot' && $_bill['status'] == 'on'}
<script>
setTimeout(() => {
$.ajax({
url: "index.php?_route=autoload_user/isLogin/{$_bill['id']}",
cache: false,
success: function(msg) {
$("#login_status_{$_bill['id']}").html(msg);
}
});
}, 2000);
</script>
{/if}
{/foreach}
{/if}
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes'}
<div class="box box-primary box-solid mb30">

View File

@ -6,218 +6,368 @@
<div class="box-header">{Lang::T('Order Internet Package')}</div>
</div>
{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>
{if $_user['service_type'] == 'PPPoE'}
{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-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>
{/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- 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 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>
{/foreach}
{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}
{elseif $_user['service_type'] == 'Hotspot'}
{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}
{elseif $_user['service_type'] == 'Others' || $_user['service_type'] == '' && (Lang::arrayCount($radius_pppoe)>0 || Lang::arrayCount($radius_hotspot)>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">
{if Lang::arrayCount($radius_pppoe)>0}
{foreach $radius_pppoe 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/pppoe/{$plan['id']}" onclick="return confirm('{Lang::T('Buy this? your active package will be overwritten')}')" 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/pppoe/{$plan['id']}" onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwritten')}')" 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/pppoe/{$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}
{/if}
{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>
{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/hotspot/{$plan['id']}" onclick="return confirm('{Lang::T('Buy this? your active package will be overwritten')}')" 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/hotspot/{$plan['id']}" onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwritten')}')" 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/hotspot/{$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}
{/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-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-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-center 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/{$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>
</div>
</div>
{/if}
{/foreach}
</div>
{/if}
{if Validator::countRouterPlan($plans_pppoe,$router['name'])>0}
<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 text-center">{$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>
</div>
</div>
{/if}
{/foreach}
</div>
{/if}
</div>
{if Validator::isRouterHasPlan($plans_hotspot, $router['name']) || Validator::isRouterHasPlan($plans_pppoe, $router['name'])}
<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 $_user['service_type'] == 'Hotspot' && Validator::countRouterPlan($plans_hotspot, $router['name'])>0}
<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-center 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/{$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>
</div>
</div>
{/if}
{/foreach}
</div>
{/if}
{if $_user['service_type'] == 'PPPoE' && Validator::countRouterPlan($plans_pppoe,$router['name'])>0}
<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 text-center">{$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>
</div>
</div>
{/if}
{/foreach}
</div>
{/if}
{if $_user['service_type'] == 'Others' || $_user['service_type'] == '' && (Validator::countRouterPlan($plans_hotspot, $router['name'])>0 || Validator::countRouterPlan($plans_pppoe, $router['name'])>0)}
<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-center 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/{$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>
</div>
</div>
{/if}
{/foreach}
</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 text-center">{$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>
</div>
</div>
{/if}
{/foreach}
</div>
{/if}
</div>
{/if}
{/foreach}
</div>
</div>
</div>
{include file="sections/user-footer.tpl"}