Paket vpn tunnel remot
This commit is contained in:
parent
5f50d725f1
commit
095e8937a2
@ -317,7 +317,15 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tcf = ORM::for_table('tbl_customers_fields')
|
||||
->where('customer_id', $user['id'])
|
||||
->find_many();
|
||||
$vpn = ORM::for_table('tbl_port_pool')
|
||||
->find_one();
|
||||
$ui->assign('cf', $tcf);
|
||||
$ui->assign('vpn', $vpn);
|
||||
|
||||
$ui->assign('unpaid', ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
|
@ -113,12 +113,19 @@ switch ($action) {
|
||||
->where('type', 'Hotspot')
|
||||
->where('prepaid', 'yes')
|
||||
->find_many();
|
||||
$plans_vpn = ORM::for_table('tbl_plans')
|
||||
->where('plan_type', $account_type)
|
||||
->where('enabled', '1')->where('is_radius', 0)
|
||||
->where('type', 'VPN')
|
||||
->where('prepaid', 'yes')
|
||||
->find_many();
|
||||
}
|
||||
$ui->assign('routers', $routers);
|
||||
$ui->assign('radius_pppoe', $radius_pppoe);
|
||||
$ui->assign('radius_hotspot', $radius_hotspot);
|
||||
$ui->assign('plans_pppoe', $plans_pppoe);
|
||||
$ui->assign('plans_hotspot', $plans_hotspot);
|
||||
$ui->assign('plans_vpn', $plans_vpn);
|
||||
run_hook('customer_view_order_plan'); #HOOK
|
||||
$ui->display('user-ui/orderPlan.tpl');
|
||||
break;
|
||||
|
@ -147,6 +147,132 @@ switch ($action) {
|
||||
} else {
|
||||
r2(U . 'pool/edit/' . $id, 'e', $msg);
|
||||
}
|
||||
|
||||
case 'port':
|
||||
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/pool.js"></script>');
|
||||
|
||||
$name = _post('name');
|
||||
if ($name != '') {
|
||||
$query = ORM::for_table('tbl_port_pool')->where_like('pool_name', '%' . $name . '%')->order_by_desc('id');
|
||||
$d = Paginator::findMany($query, ['name' => $name]);
|
||||
} else {
|
||||
$query = ORM::for_table('tbl_port_pool')->order_by_desc('id');
|
||||
$d = Paginator::findMany($query);
|
||||
}
|
||||
|
||||
$ui->assign('d', $d);
|
||||
run_hook('view_port'); #HOOK
|
||||
$ui->display('port.tpl');
|
||||
break;
|
||||
|
||||
case 'add-port':
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
run_hook('view_add_port'); #HOOK
|
||||
$ui->display('port-add.tpl');
|
||||
break;
|
||||
|
||||
case 'edit-port':
|
||||
$id = $routes['2'];
|
||||
$d = ORM::for_table('tbl_port_pool')->find_one($id);
|
||||
if ($d) {
|
||||
$ui->assign('d', $d);
|
||||
run_hook('view_edit_port'); #HOOK
|
||||
$ui->display('port-edit.tpl');
|
||||
} else {
|
||||
r2(U . 'pool/port', 'e', Lang::T('Account Not Found'));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete-port':
|
||||
$id = $routes['2'];
|
||||
run_hook('delete_port'); #HOOK
|
||||
$d = ORM::for_table('tbl_port_pool')->find_one($id);
|
||||
if ($d) {
|
||||
$d->delete();
|
||||
|
||||
r2(U . 'pool/port', 's', Lang::T('Data Deleted Successfully'));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'sync':
|
||||
$pools = ORM::for_table('tbl_port_pool')->find_many();
|
||||
$log = '';
|
||||
foreach ($pools as $pool) {
|
||||
if ($pool['routers'] != 'radius') {
|
||||
(new MikrotikPppoe())->update_pool($pool, $pool);
|
||||
$log .= 'DONE: ' . $pool['port_name'] . ': ' . $pool['range_port'] . '<br>';
|
||||
}
|
||||
}
|
||||
r2(U . 'pool/list', 's', $log);
|
||||
break;
|
||||
case 'add-port-post':
|
||||
$name = _post('name');
|
||||
$port_range = _post('port_range');
|
||||
$public_ip = _post('public_ip');
|
||||
$routers = _post('routers');
|
||||
run_hook('add_pool'); #HOOK
|
||||
$msg = '';
|
||||
if (Validator::Length($name, 30, 2) == false) {
|
||||
$msg .= 'Name should be between 3 to 30 characters' . '<br>';
|
||||
}
|
||||
if ($port_range == '' or $routers == '') {
|
||||
$msg .= Lang::T('All field is required') . '<br>';
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_port_pool')->where('routers', $routers)->find_one();
|
||||
if ($d) {
|
||||
$msg .= Lang::T('Routers already have ports, each router can only have 1 port range!') . '<br>';
|
||||
}
|
||||
if ($msg == '') {
|
||||
$b = ORM::for_table('tbl_port_pool')->create();
|
||||
$b->public_ip = $public_ip;
|
||||
$b->port_name = $name;
|
||||
$b->range_port = $port_range;
|
||||
$b->routers = $routers;
|
||||
$b->save();
|
||||
r2(U . 'pool/port', 's', Lang::T('Data Created Successfully'));
|
||||
} else {
|
||||
r2(U . 'pool/add-port', 'e', $msg);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'edit-port-post':
|
||||
$name = _post('name');
|
||||
$public_ip = _post('public_ip');
|
||||
$range_port = _post('range_port');
|
||||
$routers = _post('routers');
|
||||
run_hook('edit_port'); #HOOK
|
||||
$msg = '';
|
||||
$msg = '';
|
||||
if (Validator::Length($name, 30, 2) == false) {
|
||||
$msg .= 'Name should be between 3 to 30 characters' . '<br>';
|
||||
}
|
||||
if ($range_port == '' or $routers == '') {
|
||||
$msg .= Lang::T('All field is required') . '<br>';
|
||||
}
|
||||
|
||||
$id = _post('id');
|
||||
$d = ORM::for_table('tbl_port_pool')->find_one($id);
|
||||
$old = ORM::for_table('tbl_port_pool')->find_one($id);
|
||||
if (!$d) {
|
||||
$msg .= Lang::T('Data Not Found') . '<br>';
|
||||
}
|
||||
|
||||
if ($msg == '') {
|
||||
$d->port_name = $name;
|
||||
$d->public_ip = $public_ip;
|
||||
$d->range_port = $range_port;
|
||||
$d->routers = $routers;
|
||||
$d->save();
|
||||
|
||||
|
||||
|
||||
r2(U . 'pool/port', 's', Lang::T('Data Updated Successfully'));
|
||||
} else {
|
||||
r2(U . 'pool/edit-port/' . $id, 'e', $msg);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -901,6 +901,380 @@ switch ($action) {
|
||||
r2(U . 'services/balance-add', 'e', $msg);
|
||||
}
|
||||
break;
|
||||
case 'vpn':
|
||||
$ui->assign('_title', Lang::T('VPN Plans'));
|
||||
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/pppoe.js"></script>');
|
||||
|
||||
$name = _post('name');
|
||||
$name = _req('name');
|
||||
$type1 = _req('type1');
|
||||
$type2 = _req('type2');
|
||||
$type3 = _req('type3');
|
||||
$bandwidth = _req('bandwidth');
|
||||
$valid = _req('valid');
|
||||
$device = _req('device');
|
||||
$status = _req('status');
|
||||
$router = _req('router');
|
||||
$ui->assign('type1', $type1);
|
||||
$ui->assign('type2', $type2);
|
||||
$ui->assign('type3', $type3);
|
||||
$ui->assign('bandwidth', $bandwidth);
|
||||
$ui->assign('valid', $valid);
|
||||
$ui->assign('device', $device);
|
||||
$ui->assign('status', $status);
|
||||
$ui->assign('router', $router);
|
||||
|
||||
$append_url = "&type1=" . urlencode($type1)
|
||||
. "&type2=" . urlencode($type2)
|
||||
. "&type3=" . urlencode($type3)
|
||||
. "&bandwidth=" . urlencode($bandwidth)
|
||||
. "&valid=" . urlencode($valid)
|
||||
. "&device=" . urlencode($device)
|
||||
. "&status=" . urlencode($status)
|
||||
. "&router=" . urlencode($router);
|
||||
|
||||
$bws = ORM::for_table('tbl_plans')->distinct()->select("id_bw")->where('tbl_plans.type', 'VPN')->findArray();
|
||||
$ids = array_column($bws, 'id_bw');
|
||||
if(count($ids)){
|
||||
$ui->assign('bws', ORM::for_table('tbl_bandwidth')->select("id")->select('name_bw')->where_id_in($ids)->findArray());
|
||||
}else{
|
||||
$ui->assign('bws', []);
|
||||
}
|
||||
$ui->assign('type2s', ORM::for_table('tbl_plans')->getEnum("plan_type"));
|
||||
$ui->assign('type3s', ORM::for_table('tbl_plans')->getEnum("typebp"));
|
||||
$ui->assign('valids', ORM::for_table('tbl_plans')->getEnum("validity_unit"));
|
||||
$ui->assign('routers', array_column(ORM::for_table('tbl_plans')->distinct()->select("routers")->whereNotEqual('routers', '')->findArray(), 'routers'));
|
||||
$devices = [];
|
||||
$files = scandir($DEVICE_PATH);
|
||||
foreach ($files as $file) {
|
||||
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if ($ext == 'php') {
|
||||
$devices[] = pathinfo($file, PATHINFO_FILENAME);
|
||||
}
|
||||
}
|
||||
$ui->assign('devices', $devices);
|
||||
$query = ORM::for_table('tbl_bandwidth')
|
||||
->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))
|
||||
->where('tbl_plans.type', 'VPN');
|
||||
if (!empty($type1)) {
|
||||
$query->where('tbl_plans.prepaid', $type1);
|
||||
}
|
||||
if (!empty($type2)) {
|
||||
$query->where('tbl_plans.plan_type', $type2);
|
||||
}
|
||||
if (!empty($type3)) {
|
||||
$query->where('tbl_plans.typebp', $type3);
|
||||
}
|
||||
if (!empty($bandwidth)) {
|
||||
$query->where('tbl_plans.id_bw', $bandwidth);
|
||||
}
|
||||
if (!empty($valid)) {
|
||||
$query->where('tbl_plans.validity_unit', $valid);
|
||||
}
|
||||
if (!empty($router)) {
|
||||
if ($router == 'radius') {
|
||||
$query->where('tbl_plans.is_radius', '1');
|
||||
} else {
|
||||
$query->where('tbl_plans.routers', $router);
|
||||
}
|
||||
}
|
||||
if (!empty($device)) {
|
||||
$query->where('tbl_plans.device', $device);
|
||||
}
|
||||
if (in_array($status, ['0', '1'])) {
|
||||
$query->where('tbl_plans.enabled', $status);
|
||||
}
|
||||
if ($name != '') {
|
||||
$query->where_like('tbl_plans.name_plan', '%' . $name . '%');
|
||||
}
|
||||
$d = Paginator::findMany($query, ['name' => $name], 20, $append_url);
|
||||
|
||||
$ui->assign('d', $d);
|
||||
run_hook('view_list_vpn'); #HOOK
|
||||
$ui->display('vpn.tpl');
|
||||
break;
|
||||
|
||||
case 'vpn-add':
|
||||
$ui->assign('_title', Lang::T('VPN Plans'));
|
||||
$d = ORM::for_table('tbl_bandwidth')->find_many();
|
||||
$ui->assign('d', $d);
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
$devices = [];
|
||||
$files = scandir($DEVICE_PATH);
|
||||
foreach ($files as $file) {
|
||||
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if ($ext == 'php') {
|
||||
$devices[] = pathinfo($file, PATHINFO_FILENAME);
|
||||
}
|
||||
}
|
||||
$ui->assign('devices', $devices);
|
||||
run_hook('view_add_vpn'); #HOOK
|
||||
$ui->display('vpn-add.tpl');
|
||||
break;
|
||||
|
||||
case 'vpn-edit':
|
||||
$ui->assign('_title', Lang::T('VPN Plans'));
|
||||
$id = $routes['2'];
|
||||
$d = ORM::for_table('tbl_plans')->find_one($id);
|
||||
if ($d) {
|
||||
if (empty($d['device'])) {
|
||||
if ($d['is_radius']) {
|
||||
$d->device = 'Radius';
|
||||
} else {
|
||||
$d->device = 'MikrotikVpn';
|
||||
}
|
||||
$d->save();
|
||||
}
|
||||
$ui->assign('d', $d);
|
||||
$p = ORM::for_table('tbl_pool')->where('routers', ($d['is_radius']) ? 'radius' : $d['routers'])->find_many();
|
||||
$ui->assign('p', $p);
|
||||
$b = ORM::for_table('tbl_bandwidth')->find_many();
|
||||
$ui->assign('b', $b);
|
||||
$r = [];
|
||||
if ($d['is_radius']) {
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
}
|
||||
$ui->assign('r', $r);
|
||||
$devices = [];
|
||||
$files = scandir($DEVICE_PATH);
|
||||
foreach ($files as $file) {
|
||||
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if ($ext == 'php') {
|
||||
$devices[] = pathinfo($file, PATHINFO_FILENAME);
|
||||
}
|
||||
}
|
||||
$ui->assign('devices', $devices);
|
||||
//select expired plan
|
||||
if ($d['is_radius']) {
|
||||
$exps = ORM::for_table('tbl_plans')->selects('id', 'name_plan')->where('type', 'VPN')->where("is_radius", 1)->findArray();
|
||||
} else {
|
||||
$exps = ORM::for_table('tbl_plans')->selects('id', 'name_plan')->where('type', 'VPN')->where("routers", $d['routers'])->findArray();
|
||||
}
|
||||
$ui->assign('exps', $exps);
|
||||
run_hook('view_edit_vpn'); #HOOK
|
||||
$ui->display('vpn-edit.tpl');
|
||||
} else {
|
||||
r2(U . 'services/vpn', 'e', Lang::T('Account Not Found'));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'vpn-delete':
|
||||
$id = $routes['2'];
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->find_one($id);
|
||||
if ($d) {
|
||||
run_hook('delete_vpn'); #HOOK
|
||||
|
||||
$dvc = Package::getDevice($d);
|
||||
if ($_app_stage != 'demo') {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
(new $d['device'])->remove_plan($d);
|
||||
} else {
|
||||
new Exception(Lang::T("Devices Not Found"));
|
||||
}
|
||||
}
|
||||
$d->delete();
|
||||
|
||||
r2(U . 'services/vpn', 's', Lang::T('Data Deleted Successfully'));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'vpn-add-post':
|
||||
$name = _post('name_plan');
|
||||
$plan_type = _post('plan_type');
|
||||
$radius = _post('radius');
|
||||
$id_bw = _post('id_bw');
|
||||
$price = _post('price');
|
||||
$validity = _post('validity');
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$device = _post('device');
|
||||
$pool = _post('pool_name');
|
||||
$enabled = _post('enabled');
|
||||
$prepaid = _post('prepaid');
|
||||
$expired_date = _post('expired_date');
|
||||
|
||||
|
||||
$msg = '';
|
||||
if (Validator::UnsignedNumber($validity) == false) {
|
||||
$msg .= 'The validity must be a number' . '<br>';
|
||||
}
|
||||
if (Validator::UnsignedNumber($price) == false) {
|
||||
$msg .= 'The price must be a number' . '<br>';
|
||||
}
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $pool == '') {
|
||||
$msg .= Lang::T('All field is required') . '<br>';
|
||||
}
|
||||
if (empty($radius)) {
|
||||
if ($routers == '') {
|
||||
$msg .= Lang::T('All field is required') . '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->where('name_plan', $name)->find_one();
|
||||
if ($d) {
|
||||
$msg .= Lang::T('Name Plan Already Exist') . '<br>';
|
||||
}
|
||||
run_hook('add_vpn'); #HOOK
|
||||
if ($msg == '') {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
$raddown = '000';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
$raddown = '000000';
|
||||
}
|
||||
if ($b['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
$radup = '000';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
$radup = '000000';
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown . '/' . $b['burst'];
|
||||
$rate = trim($rate . " " . $b['burst']);
|
||||
$d = ORM::for_table('tbl_plans')->create();
|
||||
$d->type = 'VPN';
|
||||
$d->name_plan = $name;
|
||||
$d->id_bw = $id_bw;
|
||||
$d->price = $price;
|
||||
$d->plan_type = $plan_type;
|
||||
$d->validity = $validity;
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->pool = $pool;
|
||||
if (!empty($radius)) {
|
||||
$d->is_radius = 1;
|
||||
$d->routers = '';
|
||||
} else {
|
||||
$d->is_radius = 0;
|
||||
$d->routers = $routers;
|
||||
}
|
||||
if ($prepaid == 'no') {
|
||||
if ($expired_date > 28 && $expired_date < 1) {
|
||||
$expired_date = 20;
|
||||
}
|
||||
$d->expired_date = $expired_date;
|
||||
} else {
|
||||
$d->expired_date = 0;
|
||||
}
|
||||
$d->enabled = $enabled;
|
||||
$d->prepaid = $prepaid;
|
||||
$d->device = $device;
|
||||
$d->save();
|
||||
|
||||
$dvc = Package::getDevice($d);
|
||||
if ($_app_stage != 'demo') {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
(new $d['device'])->add_plan($d);
|
||||
} else {
|
||||
new Exception(Lang::T("Devices Not Found"));
|
||||
}
|
||||
}
|
||||
r2(U . 'services/vpn', 's', Lang::T('Data Created Successfully'));
|
||||
} else {
|
||||
r2(U . 'services/vpn-add', 'e', $msg);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'edit-vpn-post':
|
||||
$id = _post('id');
|
||||
$plan_type = _post('plan_type');
|
||||
$name = _post('name_plan');
|
||||
$id_bw = _post('id_bw');
|
||||
$price = _post('price');
|
||||
$validity = _post('validity');
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$device = _post('device');
|
||||
$pool = _post('pool_name');
|
||||
$plan_expired = _post('plan_expired');
|
||||
$enabled = _post('enabled');
|
||||
$prepaid = _post('prepaid');
|
||||
$expired_date = _post('expired_date');
|
||||
$on_login = _post('on_login');
|
||||
$on_logout = _post('on_logout');
|
||||
|
||||
$msg = '';
|
||||
if (Validator::UnsignedNumber($validity) == false) {
|
||||
$msg .= 'The validity must be a number' . '<br>';
|
||||
}
|
||||
if (Validator::UnsignedNumber($price) == false) {
|
||||
$msg .= 'The price must be a number' . '<br>';
|
||||
}
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $pool == '') {
|
||||
$msg .= Lang::T('All field is required') . '<br>';
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->where('id', $id)->find_one();
|
||||
$old = ORM::for_table('tbl_plans')->where('id', $id)->find_one();
|
||||
if ($d) {
|
||||
} else {
|
||||
$msg .= Lang::T('Data Not Found') . '<br>';
|
||||
}
|
||||
run_hook('edit_vpn'); #HOOK
|
||||
if ($msg == '') {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
$raddown = '000';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
$raddown = '000000';
|
||||
}
|
||||
if ($b['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
$radup = '000';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
$radup = '000000';
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown . '/' . $b['burst'];
|
||||
$rate = trim($rate . " " . $b['burst']);
|
||||
|
||||
$d->name_plan = $name;
|
||||
$d->id_bw = $id_bw;
|
||||
$d->price = $price;
|
||||
$d->plan_type = $plan_type;
|
||||
$d->validity = $validity;
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->routers = $routers;
|
||||
$d->pool = $pool;
|
||||
$d->plan_expired = $plan_expired;
|
||||
$d->enabled = $enabled;
|
||||
$d->prepaid = $prepaid;
|
||||
$d->device = $device;
|
||||
$d->on_login = $on_login;
|
||||
$d->on_logout = $on_logout;
|
||||
if ($prepaid == 'no') {
|
||||
if ($expired_date > 28 && $expired_date < 1) {
|
||||
$expired_date = 20;
|
||||
}
|
||||
$d->expired_date = $expired_date;
|
||||
} else {
|
||||
$d->expired_date = 0;
|
||||
}
|
||||
$d->save();
|
||||
|
||||
$dvc = Package::getDevice($d);
|
||||
if ($_app_stage != 'demo') {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
(new $d['device'])->update_plan($old, $d);
|
||||
} else {
|
||||
new Exception(Lang::T("Devices Not Found"));
|
||||
}
|
||||
}
|
||||
r2(U . 'services/vpn', 's', Lang::T('Data Updated Successfully'));
|
||||
} else {
|
||||
r2(U . 'services/vpn-edit/' . $id, 'e', $msg);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$ui->display('a404.tpl');
|
||||
}
|
||||
|
@ -295,6 +295,16 @@ switch ($action) {
|
||||
$d->value = _post('pppoe_plan');
|
||||
$d->save();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'vpn_plan')->find_one();
|
||||
if ($d) {
|
||||
$d->value = _post('vpn_plan');
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'vpn_plan';
|
||||
$d->value = _post('vpn_plan');
|
||||
$d->save();
|
||||
}
|
||||
|
||||
$currency_code = $_POST['currency_code'];
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'currency_code')->find_one();
|
||||
|
@ -155,5 +155,11 @@
|
||||
"2024.8.28" : [
|
||||
"ALTER TABLE `tbl_routers` ADD `status` ENUM('Online', 'Offline') DEFAULT 'Online' AFTER `coordinates`;",
|
||||
"ALTER TABLE `tbl_routers` ADD `last_seen` DATETIME AFTER `status`;"
|
||||
],
|
||||
"2024.9.13" : [
|
||||
"ALTER TABLE `tbl_plans` CHANGE `type` `type` ENUM('Hotspot','PPPOE','VPN','Balance') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;",
|
||||
"ALTER TABLE `tbl_customers` CHANGE `service_type` `service_type` ENUM('Hotspot','PPPoE','VPN','Others') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'Others' COMMENT 'For selecting user type';",
|
||||
"ALTER TABLE `tbl_transactions` CHANGE `type` `type` ENUM('Hotspot','PPPOE','VPN','Balance') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;",
|
||||
"CREATE TABLE IF NOT EXISTS `tbl_port_pool` ( `id` int(10) NOT NULL AUTO_INCREMENT , `public_ip` varchar(40) NOT NULL, `port_name` varchar(40) NOT NULL, `range_port` varchar(40) NOT NULL, `routers` varchar(40) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;"
|
||||
]
|
||||
}
|
@ -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"
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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
51
ui/ui/port-add.tpl
Normal 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
49
ui/ui/port-edit.tpl
Normal 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
76
ui/ui/port.tpl
Normal 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>
|
||||
</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"}
|
@ -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">
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -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}
|
||||
|
@ -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>
|
||||
|
@ -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
188
ui/ui/vpn-add.tpl
Normal 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
255
ui/ui/vpn-edit.tpl
Normal 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
179
ui/ui/vpn.tpl
Normal 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')} & {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"}
|
Loading…
x
Reference in New Issue
Block a user