Paket vpn tunnel remot

This commit is contained in:
agamsatria 2024-09-13 00:43:46 +07:00
parent 5f50d725f1
commit 095e8937a2
21 changed files with 1502 additions and 6 deletions

View file

@ -128,6 +128,14 @@
</div>
<span class="help-block col-md-4">{Lang::T('Change title in user Plan order')}</span>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('VPN Package')}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="vpn_plan" name="vpn_plan"
value="{if $_c['vpn_plan']==''}VPN Plan{else}{$_c['vpn_plan']}{/if}">
</div>
<span class="help-block col-md-4">{Lang::T('Change title in user Plan order')}</span>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary"

View file

@ -70,6 +70,7 @@
<option value="Hotspot">Hotspot
</option>
<option value="PPPoE">PPPoE</option>
<option value="VPN">VPN</option>
<option value="Others">{Lang::T('Others')}</option>
</select>
</div>

View file

@ -75,6 +75,7 @@
<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="VPN" {if $d['service_type'] eq 'VPN' }selected{/if}>VPN</option>
<option value="Others" {if $d['service_type'] eq 'Others' }selected{/if}>Others</option>
</select>
</div>

View file

@ -95,9 +95,13 @@
{/if}
</td>
{if $ds['type'] == 'Hotspot'}
<td><a href="{$_url}services/edit/{$ds['plan_id']}">{$ds['namebp']}</a></td>
{else}
<td><a href="{$_url}services/pppoe-edit/{$ds['plan_id']}">{$ds['namebp']}</a></td>
<td><a href="{$_url}services/edit/{$ds['plan_id']}">{$ds['namebp']}</a></td>
{/if}
{if $ds['type'] == 'PPPOE'}
<td><a href="{$_url}services/pppoe-edit/{$ds['plan_id']}">{$ds['namebp']}</a></td>
{/if}
{if $ds['type'] == 'VPN'}
<td><a href="{$_url}services/vpn-edit/{$ds['plan_id']}">{$ds['namebp']}</a></td>
{/if}
<td>{$ds['type']}</td>
<td>{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}</td>

51
ui/ui/port-add.tpl Normal file
View file

@ -0,0 +1,51 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Add Port Pool')}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}pool/add-port-post" >
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Port Name')}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name" name="name" placeholder="Vpn Tunnel">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Public IP')}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="public_ip" name="public_ip" placeholder="12.34.56.78">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Range Port')}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="port_range" name="port_range" placeholder=" 3000-8000">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{Lang::T('Routers')}</a></label>
<div class="col-md-6">
<select id="routers" name="routers" class="form-control select2">
{foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary" type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}pool/port">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

49
ui/ui/port-edit.tpl Normal file
View file

@ -0,0 +1,49 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Edit Port')}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}pool/edit-port-post" >
<input type="hidden" name="id" value="{$d['id']}">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Port Name')}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name" name="name" value="{$d['port_name']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Public IP')}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="public_ip" name="public_ip" value="{$d['public_ip']}" placeholder="12.34.56.78">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Range Port')}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="range_port" name="range_port" value="{$d['range_port']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Routers')}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success" type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}pool/port">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

76
ui/ui/port.tpl Normal file
View file

@ -0,0 +1,76 @@
{include file="sections/header.tpl"}
<!-- port -->
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-primary">
<div class="panel-heading">
<div class="btn-group pull-right">
<a class="btn btn-primary btn-xs" title="save" href="{$_url}pool/sync"
onclick="return confirm('This will sync/send IP port to Mikrotik?')"><span
class="glyphicon glyphicon-refresh" aria-hidden="true"></span> sync</a>
</div>
{Lang::T('Port Pool')} - VPN Tunnels
</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}pool/port/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control"
placeholder="{Lang::T('Search by Name')}...">
<div class="input-group-btn">
<button class="btn btn-success" type="submit">{Lang::T('Search')}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}pool/add-port" class="btn btn-primary btn-block"><i
class="ion ion-android-add"> </i> {Lang::T('New port')}</a>
</div>&nbsp;
</div>
<div class="table-responsive">
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{Lang::T('Port Name')}</th>
<th>{Lang::T('Public IP')}</th>
<th>{Lang::T('Range Port')}</th>
<th>{Lang::T('Routers')}</th>
<th>{Lang::T('Manage')}</th>
<th>ID</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['port_name']}</td>
<td>{$ds['public_ip']}</td>
<td>{$ds['range_port']}</td>
<td>{$ds['routers']}</td>
<td align="center">
<a href="{$_url}pool/edit-port/{$ds['id']}" class="btn btn-info btn-xs">{Lang::T('Edit')}</a>
<a href="{$_url}pool/delete-port/{$ds['id']}" id="{$ds['id']}"
onclick="return confirm('{Lang::T('Delete')}?')"
class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-trash"></i></a>
</td>
<td>{$ds['id']}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{include file="pagination.tpl"}
<div class="bs-callout bs-callout-info" id="callout-navbar-role">
<h4>{Lang::T('Create expired Internet Plan')}</h4>
<p>{Lang::T('When customer expired, you can move it to Expired Internet Plan')}</p>
</div>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View file

@ -22,6 +22,7 @@
<div class="col-md-6">
<label><input type="radio" id="Hot" name="type" value="Hotspot"> {Lang::T('Hotspot Plans')}</label>
<label><input type="radio" id="POE" name="type" value="PPPOE"> {Lang::T('PPPOE Plans')}</label>
<label><input type="radio" id="VPN" name="type" value="VPN"> {Lang::T('VPN Plans')}</label>
</div>
</div>
<div class="form-group">

View file

@ -96,7 +96,7 @@ $(function() {
});
};
}else{
} else if ($('#POE').is(':checked')) {
$.ajax({
type: "POST",
dataType: "html",
@ -117,6 +117,27 @@ $(function() {
}
});
});
} else {
$.ajax({
type: "POST",
dataType: "html",
url: "index.php?_route=autoload/server",
success: function(msg){
$("#server").html(msg);
}
});
$("#server").change(function(){
var server = $("#server").val();
$.ajax({
type: "POST",
dataType: "html",
url: "index.php?_route=autoload/plan",
data: "jenis=VPN&server="+server,
success: function(msg){
$("#plan").html(msg);
}
});
});
}
});
});

View file

@ -1283,6 +1283,8 @@
href="{$_url}services/hotspot">Hotspot</a></li>
<li {if $_routes[1] eq 'pppoe' }class="active" {/if}><a
href="{$_url}services/pppoe">PPPOE</a></li>
<li {if $_routes[1] eq 'vpn' }class="active" {/if}><a
href="{$_url}services/vpn">VPN</a></li>
<li {if $_routes[1] eq 'list' }class="active" {/if}><a
href="{$_url}bandwidth/list">Bandwidth</a></li>
{if $_c['enable_balance'] == 'yes'}
@ -1341,6 +1343,8 @@
href="{$_url}routers">Routers</a></li>
<li {if $_routes[0] eq 'pool' and $_routes[1] eq 'list' }class="active" {/if}><a
href="{$_url}pool/list">IP Pool</a></li>
<li {if $_routes[0] eq 'pool' and $_routes[1] eq 'port' }class="active" {/if}><a
href="{$_url}pool/port">Port Pool</a></li>
<li {if $_routes[0] eq 'routers' and $_routes[1] eq 'maps' }class="active" {/if}><a
href="{$_url}routers/maps">{Lang::T('Routers Maps')}</a></li>
{$_MENU_NETWORK}

View file

@ -88,6 +88,8 @@
Hotspot
{elseif $_user.service_type == 'PPPoE'}
PPPoE
{elseif $_user.service_type == 'VPN'}
VPN
{elseif $_user.service_type == 'Others' || $_user.service_type == null}
Others
{/if}
@ -165,8 +167,10 @@
<div class="btn-group pull-right">
{if $_bill['type'] == 'Hotspot'}
{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}
{else}
{else if $_bill['type'] == 'PPPOE'}
{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
{else if $_bill['type'] == 'VPN'}
{if $_c['pppoe_plan']==''}VPN Plan{else}{$_c['vpn_plan']}{/if}
{/if}
</div>
</div>
@ -215,6 +219,25 @@
{$_bill['plan_type']}
</td>
</tr>
{if $_bill['type'] == 'VPN' && $_bill['routers'] == $vpn['routers']}
<tr>
<td class="small text-success text-uppercase text-normal">{Lang::T('Public IP')}</td>
<td class="small mb15">{$vpn['public_ip']} / {$vpn['port_name']}</td>
</tr>
<tr>
<td class="small text-success text-uppercase text-normal">{Lang::T('Private IP')}</td>
<td class="small mb15">{$_user['pppoe_ip']}</td>
</tr>
{foreach $cf as $tcf}
<tr>
{if $tcf['field_name'] == 'Winbox' or $tcf['field_name'] == 'Api' or $tcf['field_name'] == 'Web'}
<td class="small text-info text-uppercase text-normal">{$tcf['field_name']} - Port</td>
<td class="small mb15"><a href="http://{$vpn['public_ip']}:{$tcf['field_value']}" target="_blank">{$tcf['field_value']}</a></td>
</tr>
{/if}
{/foreach}
{/if}
{if $nux_ip neq ''}
<tr>
<td class="small text-primary text-uppercase text-normal">{Lang::T('Current IP')}</td>

View file

@ -226,6 +226,7 @@
{/if}
{foreach $routers as $router}
{if Validator::isRouterHasPlan($plans_hotspot, $router['name']) || Validator::isRouterHasPlan($plans_pppoe,
$router['name']) || Validator::isRouterHasPlan($plans_vpn,
$router['name'])}
<div class="box box-solid box-primary bg-gray">
<div class="box-header text-white text-bold">{$router['name']}</div>
@ -338,9 +339,62 @@
{/if}
{/foreach}
</div>
{/if}
{if $_user['service_type'] == 'VPN' && Validator::countRouterPlan($plans_vpn,$router['name'])>0}
<div class="box-header text-white">{if $_c['vpn_plan']==''}VPN Plan{else}{$_c['vpn_plan']}{/if}</div>
<div class="box-body row">
{foreach $plans_vpn 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">
<div style="margin-left: 5px; margin-right: 5px;">
<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>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/gateway/{$router['id']}/{$plan['id']}&stoken={App::getToken()}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">{Lang::T('Buy')}</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/{$router['id']}/{$plan['id']}&stoken={App::getToken()}"
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']}&stoken={App::getToken()}"
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 || Validator::countRouterPlan($plans_vpn,
$router['name'])>0)}
<div class="box-header text-white">{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}
</div>
@ -443,6 +497,56 @@
{/if}
{/foreach}
</div>
<div class="box-header text-white">{if $_c['vpn_plan']==''}VPN Plan{else}{$_c['vpn_plan']}{/if}</div>
<div class="box-body row">
{foreach $plans_vpn 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">
<div style="margin-left: 5px; margin-right: 5px;">
<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>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/gateway/{$router['id']}/{$plan['id']}&stoken={App::getToken()}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">{Lang::T('Buy')}</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/{$router['id']}/{$plan['id']}&stoken={App::getToken()}"
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']}&stoken={App::getToken()}"
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}

188
ui/ui/vpn-add.tpl Normal file
View file

@ -0,0 +1,188 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Add Service Plan')}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}services/vpn-add-post">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Status')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Customer cannot buy disabled Plan, but admin can recharge it, use it if you want only admin recharge it">?</a>
</label>
<div class="col-md-10">
<input type="radio" checked name="enabled" value="1"> {Lang::T('Enable')}
<input type="radio" name="enabled" value="0"> {Lang::T('Disable')}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Type')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Postpaid will have fix expired date">?</a>
</label>
<div class="col-md-10">
<input type="radio" name="prepaid" onclick="prePaid()" value="yes" checked> {Lang::T('Prepaid')}
<input type="radio" name="prepaid" onclick="postPaid()" value="no"> {Lang::T('Postpaid')}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Type')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Personal Plan will only show to personal Customer, Business plan will only show to Business Customer">?</a>
</label>
<div class="col-md-10">
<input type="radio" name="plan_type" value="Personal" checked> {Lang::T('Personal')}
<input type="radio" name="plan_type" value="Business"> {Lang::T('Business')}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Device')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="This Device are the logic how PHPNuxBill Communicate with Mikrotik or other Devices">?</a>
</label>
<div class="col-md-6">
<select class="form-control" id="device" name="device">
{foreach $devices as $dev}
<option value="{$dev}" {if $dev == 'MikrotikVpn'}selected{/if}>{$dev}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Name')}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name_plan" maxlength="40" name="name_plan">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a
href="{$_url}bandwidth/add">{Lang::T('Bandwidth Name')}</a></label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control select2">
<option value="">{Lang::T('Select Bandwidth')}...</option>
{foreach $d as $ds}
<option value="{$ds['id']}">{$ds['name_bw']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Price')}</label>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon">{$_c['currency_code']}</span>
<input type="number" class="form-control" name="price" required>
</div>
</div>
{if $_c['enable_tax'] == 'yes'}
{if $_c['tax_rate'] == 'custom'}
<p class="help-block col-md-4">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
will be added')}</p>
{else}
<p class="help-block col-md-4">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
will be added')}</p>
{/if}
{/if}
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
<div class="col-md-4">
<input type="text" class="form-control" id="validity" name="validity">
</div>
<div class="col-md-2">
<select class="form-control" id="validity_unit" name="validity_unit">
</select>
</div>
<p class="help-block col-md-4">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}
</p>
</div>
<div class="form-group hidden" id="expired_date">
<label class="col-md-2 control-label">{Lang::T('Expired Date')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Expired will be this date every month">?</a>
</label>
<div class="col-md-6">
<input type="number" class="form-control" name="expired_date" maxlength="2" value="20" min="1" max="28" step="1" >
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a
href="{$_url}routers/add">{Lang::T('Router Name')}</a></label>
<div class="col-md-6">
<select id="routers" name="routers" required class="form-control select2">
<option value=''>{Lang::T('Select Routers')}</option>
{foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option>
{/foreach}
</select>
<p class="help-block">{Lang::T('Cannot be change after saved')}</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('IP Pool')}</a></label>
<div class="col-md-6">
<select id="pool_name" name="pool_name" required class="form-control select2">
<option value=''>{Lang::T('Select Pool')}</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button class="btn btn-primary" type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}services/pppoe">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
var preOpt = `<option value="Mins">{Lang::T('Mins')}</option>
<option value="Hrs">{Lang::T('Hrs')}</option>
<option value="Days">{Lang::T('Days')}</option>
<option value="Months">{Lang::T('Months')}</option>`;
var postOpt = `<option value="Period">{Lang::T('Period')}</option>`;
function prePaid() {
$("#validity_unit").html(preOpt);
$('#expired_date').addClass('hidden');
}
function postPaid() {
$("#validity_unit").html(postOpt);
$("#expired_date").removeClass('hidden');
}
document.addEventListener("DOMContentLoaded", function(event) {
prePaid()
})
</script>
{if $_c['radius_enable']}
{literal}
<script>
function isRadius(cek) {
if (cek.checked) {
document.getElementById("routers").required = false;
document.getElementById("routers").disabled = true;
$.ajax({
url: "index.php?_route=autoload/pool",
data: "routers=radius",
cache: false,
success: function(msg) {
$("#pool_name").html(msg);
}
});
} else {
document.getElementById("routers").required = true;
document.getElementById("routers").disabled = false;
}
}
</script>
{/literal}
{/if}
{include file="sections/footer.tpl"}

255
ui/ui/vpn-edit.tpl Normal file
View file

@ -0,0 +1,255 @@
{include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}services/edit-vpn-post">
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Edit Service Plan')} || {$d['name_plan']}</div>
<div class="panel-body">
<input type="hidden" name="id" value="{$d['id']}">
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Status')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Customer cannot buy disabled Plan, but admin can recharge it, use it if you want only admin recharge it">?</a>
</label>
<div class="col-md-9">
<input type="radio" name="enabled" value="1" {if $d['enabled'] == 1}checked{/if}> {Lang::T('Enable')}
<input type="radio" name="enabled" value="0" {if $d['enabled'] == 0}checked{/if}> {Lang::T('Disable')}
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Type')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Postpaid will have fix expired date">?</a>
</label>
<div class="col-md-9">
<input type="radio" name="prepaid" onclick="prePaid()" value="yes"
{if $d['prepaid'] == 'yes'}checked{/if}>
{Lang::T('Prepaid')}
<input type="radio" name="prepaid" onclick="postPaid()" value="no"
{if $d['prepaid'] == 'no'}checked{/if}> {Lang::T('Postpaid')}
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Plan Type')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Personal Plan will only show to personal Customer, Business plan will only show to Business Customer">?</a>
</label>
<div class="col-md-9">
<input type="radio" name="plan_type" value="Personal"
{if $d['plan_type'] == 'Personal'}checked{/if}>
{Lang::T('Personal')}
<input type="radio" name="plan_type" value="Business"
{if $d['plan_type'] == 'Business'}checked{/if}> {Lang::T('Business')}
</div>
</div>
{if $_c['radius_enable'] and $d['is_radius']}
<div class="form-group">
<label class="col-md-3 control-label">Radius
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="If you enable Radius, choose device to radius, except if you have custom device.">?</a>
</label>
<div class="col-md-9">
<label class="label label-primary">RADIUS</label>
</div>
</div>
{/if}
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Device')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="This Device are the logic how PHPNuxBill Communicate with Mikrotik or other Devices">?</a>
</label>
<div class="col-md-9">
<select class="form-control" id="device" name="device">
{foreach $devices as $dev}
<option value="{$dev}" {if $dev == $d['device']}selected{/if}>{$dev}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Plan Name')}</label>
<div class="col-md-9">
<input type="text" class="form-control" id="name_plan" maxlength="40" name="name_plan"
value="{$d['name_plan']}">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"><a
href="{$_url}bandwidth/add">{Lang::T('Bandwidth Name')}</a></label>
<div class="col-md-9">
<select id="id_bw" name="id_bw" class="form-control select2">
{foreach $b as $bs}
<option value="{$bs['id']}" {if $d['id_bw'] eq $bs['id']} selected {/if}>
{$bs['name_bw']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Plan Price')}</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon">{$_c['currency_code']}</span>
<input type="number" class="form-control" name="price" required value="{$d['price']}">
</div>
</div>
{if $_c['enable_tax'] == 'yes'}
{if $_c['tax_rate'] == 'custom'}
<p class="help-block col-md-4">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
will be added')}</p>
{else}
<p class="help-block col-md-4">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
will be added')}</p>
{/if}
{/if}
</div>
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Plan Validity')}</label>
<div class="col-md-3">
<input type="text" class="form-control" id="validity" name="validity"
value="{$d['validity']}">
</div>
<div class="col-md-6">
<select class="form-control" id="validity_unit" name="validity_unit">
{if $d['prepaid'] == yes}
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{Lang::T('Mins')}
</option>
<option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{Lang::T('Hrs')}
</option>
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{Lang::T('Days')}
</option>
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>
{Lang::T('Months')}</option>
{else}
<option value="Period" {if $d['validity_unit'] eq 'Period'} selected {/if}>
{Lang::T('Period')}</option>
{/if}
</select>
<p class="help-block">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div>
</div>
<div class="form-group {if $d['prepaid'] == yes}hidden{/if}" id="expired_date">
<label class="col-md-3 control-label">{Lang::T('Expired Date')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Expired will be this date every month">?</a>
</label>
<div class="col-md-9">
<input type="number" class="form-control" name="expired_date" maxlength="2"
value="{if $d['expired_date']}{$d['expired_date']}{else}20{/if}" min="1" max="28"
step="1">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"><a href="{$_url}pool/add">{Lang::T('IP Pool')}</a></label>
<div class="col-md-9">
<select id="pool_name" name="pool_name" required class="form-control select2">
{foreach $p as $ps}
<option value="{$ps['pool_name']}" {if $d['pool'] eq $ps['pool_name']} selected {/if}>
{$ps['pool_name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Router Name')}</label>
<div class="col-md-9">
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}"
readonly>
</div>
</div>
<legend>{Lang::T('Expired Action')} <sub>{Lang::T('Optional')}</sub></legend>
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Expired Internet Plan')}</label>
<div class="col-md-9">
<select id="plan_expired" name="plan_expired" class="form-control select2">
<option value='0'>Default - Remove Customer</option>
{foreach $exps as $exp}
<option value="{$exp['id']}" {if $d['plan_expired'] eq $exp['id']} selected {/if}>
{$exp['name_plan']}</option>
{/foreach}
</select>
<p class="help-block">
{Lang::T('When Expired, customer will be move to selected internet plan')}</p>
</div>
</div>
</div>
</div>
</div>
{if !$d['is_radius']}
<div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('on-login / on-up')}</div>
<div class="panel-body">
<textarea class="form-control" id="code" name="on_login"
style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_login']}</textarea>
</div>
</div>
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('on-logout / on-down')}</div>
<div class="panel-body">
<textarea class="form-control" id="code2" name="on_logout"
style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_logout']}</textarea>
</div>
</div>
</div>
{/if}
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success" type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}services/vpn">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
<script>
var preOpt = `<option value="Mins">{Lang::T('Mins')}</option>
<option value="Hrs">{Lang::T('Hrs')}</option>
<option value="Days">{Lang::T('Days')}</option>
<option value="Months">{Lang::T('Months')}</option>`;
var postOpt = `<option value="Period">{Lang::T('Period')}</option>`;
function prePaid() {
$("#validity_unit").html(preOpt);
$('#expired_date').addClass('hidden');
}
function postPaid() {
$("#validity_unit").html(postOpt);
$("#expired_date").removeClass('hidden');
}
</script>
<script language="javascript" type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js"></script>
<script language="javascript" type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/perl/perl.min.js"></script>
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css">
</link>
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/theme/abbott.min.css">
</link>
<script>
CodeMirror.fromTextArea(document.getElementById('code'), {
lineNumbers: true,
mode: 'text/x-perl',
});
CodeMirror.fromTextArea(document.getElementById('code2'), {
lineNumbers: true,
mode: 'text/x-perl',
});
</script>
{include file="sections/footer.tpl"}

179
ui/ui/vpn.tpl Normal file
View file

@ -0,0 +1,179 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-primary">
<div class="panel-heading">
<div class="btn-group pull-right">
<a class="btn btn-primary btn-xs" title="save" href="{$_url}services/sync/vpn"
onclick="return confirm('This will sync/send vpn plan to Mikrotik?')"><span
class="glyphicon glyphicon-refresh" aria-hidden="true"></span> sync</a>
</div>{Lang::T('VPN Package')}
</div>
<form id="site-search" method="post" action="{$_url}services/vpn">
<div class="panel-body">
<div class="row row-no-gutters" style="padding: 5px">
<div class="col-lg-2">
<div class="input-group">
<div class="input-group-btn">
<a class="btn btn-danger" title="Clear Search Query"
href="{$_url}services/vpn"><span
class="glyphicon glyphicon-remove-circle"></span></a>
</div>
<input type="text" name="name" class="form-control"
placeholder="{Lang::T('Search by Name')}...">
</div>
</div>
<div class="col-lg-1 col-xs-4">
<select class="form-control" id="type1" name="type1">
<option value="">{Lang::T('Prepaid')} &amp; {Lang::T('Postpaid')}</option>
<option value="yes" {if $type1 eq 'yes' }selected{/if}>{Lang::T('Prepaid')}</option>
<option value="no" {if $type1 eq 'no' }selected{/if}>{Lang::T('Postpaid')}</option>
</select>
</div>
<div class="col-lg-1 col-xs-4">
<select class="form-control" id="type2" name="type2">
<option value="">{Lang::T('Type')}</option>
{foreach $type2s as $t}
<option value="{$t}" {if $type2 eq $t }selected{/if}>{Lang::T($t)}
</option>
{/foreach}
</select>
</div>
<div class="col-lg-1 col-xs-4">
<select class="form-control" id="bandwidth" name="bandwidth">
<option value="">Bandwidth</option>
{foreach $bws as $b}
<option value="{$b['id']}" {if $bandwidth eq $b['id'] }selected{/if}>
{$b['name_bw']}
</option>
{/foreach}
</select>
</div>
<div class="col-lg-1 col-xs-4">
<select class="form-control" id="type3" name="type3">
<option value="">{Lang::T('Category')}</option>
{foreach $type3s as $t}
<option value="{$t}" {if $type3 eq $t }selected{/if}>{$t}
</option>
{/foreach}
</select>
</div>
<div class="col-lg-1 col-xs-4">
<select class="form-control" id="valid" name="valid">
<option value="">{Lang::T('Validity')}</option>
{foreach $valids as $v}
<option value="{$v}" {if $valid eq $v }selected{/if}>{$v}
</option>
{/foreach}
</select>
</div>
<div class="col-lg-1 col-xs-4">
<select class="form-control" id="router" name="router">
<option value="">{Lang::T('Location')}</option>
{foreach $routers as $r}
<option value="{$r}" {if $router eq $r }selected{/if}>{$r}</option>
{/foreach}
<option value="radius" {if $router eq 'radius' }selected{/if}>Radius</option>
</select>
</div>
<div class="col-lg-1 col-xs-4">
<select class="form-control" id="device" name="device">
<option value="">{Lang::T('Device')}</option>
{foreach $devices as $r}
<option value="{$r}" {if $device eq $r }selected{/if}>{$r}</option>
{/foreach}
</select>
</div>
<div class="col-lg-1 col-xs-4">
<select class="form-control" id="status" name="status">
<option value="-">{Lang::T('Status')}</option>
<option value="1" {if $status eq '1' }selected{/if}>{Lang::T('Enabled')}</option>
<option value="0" {if $status eq '0' }selected{/if}>{Lang::T('Disable')}</option>
</select>
</div>
<div class="col-lg-1 col-xs-8">
<button class="btn btn-success btn-block" type="submit"><span
class="fa fa-search"></span></button>
</div>
<div class="col-lg-1 col-xs-4">
<a href="{$_url}services/vpn-add" class="btn btn-primary btn-block"
title="{Lang::T('New Service Plan')}"><i class="ion ion-android-add"></i></a>
</div>
</div>
</div>
</form>
<div class="table-responsive">
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th></th>
<th colspan="4" class="text-center">{Lang::T('Internet Plan')}</th>
<th></th>
<th colspan="2" class="text-center" style="background-color: rgb(243, 241, 172);">
{Lang::T('Expired')}</th>
<th colspan="4"></th>
</tr>
<tr>
<th>{Lang::T('Name')}</th>
<th>{Lang::T('Type')}</th>
<th><a href="{$_url}bandwidth/list">{Lang::T('Bandwidth')}</a></th>
<th>{Lang::T('Price')}</th>
<th>{Lang::T('Validity')}</th>
<th><a href="{$_url}pool/list">{Lang::T('IP Pool')}</a></th>
<th style="background-color: rgb(243, 241, 172);">{Lang::T('Internet Plan')}</th>
<th style="background-color: rgb(243, 241, 172);">{Lang::T('Date')}</th>
<th><a href="{$_url}routers/list">{Lang::T('Location')}</a></th>
<th>{Lang::T('Device')}</th>
<th>{Lang::T('Manage')}</th>
<th>ID</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr {if $ds['enabled'] != 1}class="danger" title="disabled" {/if}>
<td>{$ds['name_plan']}</td>
<td>{$ds['plan_type']} {if $ds['prepaid'] != 'yes'}<b>{Lang::T('Postpaid')}</b>{else}{Lang::T('Prepaid')}{/if}</td>
<td>{$ds['name_bw']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td>
<td>{$ds['pool']}</td>
<td>{if $ds['plan_expired']}<a
href="{$_url}services/vpn-edit/{$ds['plan_expired']}">{Lang::T('Yes')}</a>{else}{Lang::T('No')}
{/if}</td>
<td>{if $ds['prepaid'] == no}{$ds['expired_date']}{/if}</td>
<td>
{if $ds['is_radius']}
<span class="label label-primary">RADIUS</span>
{else}
{if $ds['routers']!=''}
<a href="{$_url}routers/edit/0&name={$ds['routers']}">{$ds['routers']}</a>
{/if}
{/if}
</td>
<td>{$ds['device']}</td>
<td>
<a href="{$_url}services/vpn-edit/{$ds['id']}"
class="btn btn-info btn-xs">{Lang::T('Edit')}</a>
<a href="{$_url}services/vpn-delete/{$ds['id']}"
onclick="return confirm('{Lang::T('Delete')}?')" id="{$ds['id']}"
class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-trash"></i></a>
</td>
<td>{$ds['id']}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
<div class="panel-footer">
{include file="pagination.tpl"}
<div class="bs-callout bs-callout-info" id="callout-navbar-role">
<h4>{Lang::T('Create expired Internet Plan')}</h4>
<p>{Lang::T('When customer expired, you can move it to Expired Internet Plan')}</p>
</div>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}