This commit is contained in:
Ibnu Maksum 2024-03-13 14:32:10 +07:00
parent ed9a411095
commit ca0edb4e17
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
21 changed files with 305 additions and 174 deletions

View File

@ -315,4 +315,5 @@ ALTER TABLE `tbl_customers` ADD `created_by` INT NOT NULL DEFAULT '0' AFTER `aut
ALTER TABLE `tbl_plans` ADD `list_expired` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'address list' AFTER `pool_expired`; ALTER TABLE `tbl_plans` ADD `list_expired` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'address list' AFTER `pool_expired`;
ALTER TABLE `tbl_bandwidth` ADD `burst` VARCHAR(128) NOT NULL DEFAULT '' AFTER `rate_up_unit`; ALTER TABLE `tbl_bandwidth` ADD `burst` VARCHAR(128) NOT NULL DEFAULT '' AFTER `rate_up_unit`;
ALTER TABLE `tbl_transactions` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`; ALTER TABLE `tbl_transactions` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;
ALTER TABLE `tbl_user_recharges` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`; ALTER TABLE `tbl_user_recharges` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;
ALTER TABLE `tbl_plans` CHANGE `allow_purchase` `prepaid` ENUM('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'yes' COMMENT 'is prepaid';

View File

@ -32,12 +32,12 @@ class Package
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->find_one(); $p = ORM::for_table('tbl_plans')->where('id', $plan_id)->find_one();
if(isset($zero) && $zero==1){ if (isset($zero) && $zero == 1) {
$p['price'] = 0; $p['price'] = 0;
} }
if(!$p['enabled']){ if (!$p['enabled']) {
if(!isset($admin) || !isset($admin['id']) || empty($admin['id'])){ if (!isset($admin) || !isset($admin['id']) || empty($admin['id'])) {
r2(U . 'home', 'e', Lang::T('Plan Not found')); r2(U . 'home', 'e', Lang::T('Plan Not found'));
} }
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
@ -114,12 +114,29 @@ class Package
} }
/** /**
* 1 Customer only can have 1 PPPOE and 1 Hotspot Plan * 1 Customer only can have 1 PPPOE and 1 Hotspot Plan, 1 prepaid and 1 postpaid
*/ */
$b = ORM::for_table('tbl_user_recharges') $b = ORM::for_table('tbl_user_recharges')
->select('tbl_user_recharges.id', 'id')
->select('customer_id')
->select('username')
->select('plan_id')
->select('namebp')
->select('recharged_on')
->select('recharged_time')
->select('expiration')
->select('time')
->select('status')
->select('method')
->select('tbl_user_recharges.routers', 'routers')
->select('tbl_user_recharges.type', 'type')
->select('admin_id')
->select('prepaid')
->where('customer_id', $id_customer) ->where('customer_id', $id_customer)
->where('routers', $router_name) ->where('tbl_user_recharges.routers', $router_name)
->where('Type', $p['type']) ->where('tbl_user_recharges.Type', $p['type'])
->where('prepaid', $p['prepaid'])
->join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id'))
->find_one(); ->find_one();
run_hook("recharge_user"); run_hook("recharge_user");
@ -608,7 +625,7 @@ class Package
public static function _raid() public static function _raid()
{ {
return ORM::for_table('tbl_transactions')->max('id')+1; return ORM::for_table('tbl_transactions')->max('id') + 1;
} }
/** /**

View File

@ -8,15 +8,16 @@
class User class User
{ {
public static function getID(){ public static function getID()
{
global $db_password; global $db_password;
if(isset($_SESSION['uid']) && !empty($_SESSION['uid'])){ if (isset($_SESSION['uid']) && !empty($_SESSION['uid'])) {
return $_SESSION['uid']; return $_SESSION['uid'];
}else if(isset($_COOKIE['uid'])){ } else if (isset($_COOKIE['uid'])) {
// id.time.sha1 // id.time.sha1
$tmp = explode('.',$_COOKIE['uid']); $tmp = explode('.', $_COOKIE['uid']);
if(sha1($tmp[0].'.'.$tmp[1].'.'.$db_password)==$tmp[2]){ if (sha1($tmp[0] . '.' . $tmp[1] . '.' . $db_password) == $tmp[2]) {
if(time()-$tmp[1] < 86400*30){ if (time() - $tmp[1] < 86400 * 30) {
$_SESSION['uid'] = $tmp[0]; $_SESSION['uid'] = $tmp[0];
return $tmp[0]; return $tmp[0];
} }
@ -25,37 +26,93 @@ class User
return 0; return 0;
} }
public static function setCookie($uid){ public static function getAttribute($name, $id = 0)
{
if (!$id) {
$id = User::getID();
}
if (!$id) {
return '';
}
$f = ORM::for_table('tbl_customers_fields')->where('field_name', $name)->where('customer_id', $id)->find_one();
if ($f) {
return $f['field_value'];
}
return '';
}
public static function getAttributes($endWith, $id = 0)
{
if (!$id) {
$id = User::getID();
}
if (!$id) {
return [];
}
$attrs = [];
$f = ORM::for_table('tbl_customers_fields')->where_like('field_name', $endWith)->where('customer_id', $id)->find_one();
if ($f) {
foreach ($f as $k) {
$attrs[$k['field_name']] = $k['field_value'];
}
return $attrs;
}
return [];
}
public static function setCookie($uid)
{
global $db_password; global $db_password;
if(isset($uid)){ if (isset($uid)) {
$time = time(); $time = time();
setcookie('uid', $uid.'.'.$time.'.'.sha1($uid.'.'.$time.'.'.$db_password), time()+86400*30); setcookie('uid', $uid . '.' . $time . '.' . sha1($uid . '.' . $time . '.' . $db_password), time() + 86400 * 30);
} }
} }
public static function removeCookie(){ public static function removeCookie()
if(isset($_COOKIE['uid'])){ {
setcookie('uid', '', time()-86400); if (isset($_COOKIE['uid'])) {
setcookie('uid', '', time() - 86400);
} }
} }
public static function _info($id = 0) public static function _info($id = 0)
{ {
if(!$id){ if (!$id) {
$id = User::getID(); $id = User::getID();
} }
$d = ORM::for_table('tbl_customers')->find_one($id); $d = ORM::for_table('tbl_customers')->find_one($id);
if(empty($d['username'])){ if (empty($d['username'])) {
r2(U . 'logout', 'd', ''); r2(U . 'logout', 'd', '');
} }
return $d; return $d;
} }
public static function _billing() public static function _billing($id = 0)
{ {
$id = User::getID(); if (!$id) {
$d = ORM::for_table('tbl_user_recharges')->where('customer_id', $id)->find_many(); $id = User::getID();
}
$d = ORM::for_table('tbl_user_recharges')
->select('tbl_user_recharges.id', 'id')
->select('customer_id')
->select('username')
->select('plan_id')
->select('namebp')
->select('recharged_on')
->select('recharged_time')
->select('expiration')
->select('time')
->select('status')
->select('method')
->select('tbl_user_recharges.routers', 'routers')
->select('tbl_user_recharges.type', 'type')
->select('admin_id')
->select('prepaid')
->where('customer_id', $id)
->join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id'))
->find_many();
return $d; return $d;
} }
} }

View File

@ -37,7 +37,7 @@ switch ($action) {
} }
$ui->assign('_title', 'Top Up'); $ui->assign('_title', 'Top Up');
$ui->assign('_system_menu', 'balance'); $ui->assign('_system_menu', 'balance');
$plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->where('allow_purchase', 'yes')->find_many(); $plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->where('prepaid', 'yes')->find_many();
$ui->assign('plans_balance', $plans_balance); $ui->assign('plans_balance', $plans_balance);
$ui->display('user-orderBalance.tpl'); $ui->display('user-orderBalance.tpl');
break; break;
@ -49,24 +49,24 @@ switch ($action) {
$ui->assign('_system_menu', 'package'); $ui->assign('_system_menu', 'package');
if (!empty($_SESSION['nux-router'])) { if (!empty($_SESSION['nux-router'])) {
if ($_SESSION['nux-router'] == 'radius') { if ($_SESSION['nux-router'] == 'radius') {
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->where('allow_purchase', 'yes')->find_many(); $radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->where('prepaid', 'yes')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->where('allow_purchase', 'yes')->find_many(); $radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->where('prepaid', 'yes')->find_many();
} else { } else {
$routers = ORM::for_table('tbl_routers')->where('id', $_SESSION['nux-router'])->find_many(); $routers = ORM::for_table('tbl_routers')->where('id', $_SESSION['nux-router'])->find_many();
$rs = []; $rs = [];
foreach ($routers as $r) { foreach ($routers as $r) {
$rs[] = $r['name']; $rs[] = $r['name'];
} }
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'PPPOE')->where('allow_purchase', 'yes')->find_many(); $plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'PPPOE')->where('prepaid', 'yes')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'Hotspot')->where('allow_purchase', 'yes')->find_many(); $plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'Hotspot')->where('prepaid', 'yes')->find_many();
} }
} else { } else {
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->where('allow_purchase', 'yes')->find_many(); $radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->where('prepaid', 'yes')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->where('allow_purchase', 'yes')->find_many(); $radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->where('prepaid', 'yes')->find_many();
$routers = ORM::for_table('tbl_routers')->find_many(); $routers = ORM::for_table('tbl_routers')->find_many();
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'PPPOE')->where('allow_purchase', 'yes')->find_many(); $plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'PPPOE')->where('prepaid', 'yes')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'Hotspot')->where('allow_purchase', 'yes')->find_many(); $plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'Hotspot')->where('prepaid', 'yes')->find_many();
} }
$ui->assign('routers', $routers); $ui->assign('routers', $routers);
$ui->assign('radius_pppoe', $radius_pppoe); $ui->assign('radius_pppoe', $radius_pppoe);

View File

@ -692,7 +692,11 @@ switch ($action) {
} }
$ui->assign('_title', Lang::T('Refill Balance')); $ui->assign('_title', Lang::T('Refill Balance'));
$ui->assign('xfooter', $select2_customer); $ui->assign('xfooter', $select2_customer);
$ui->assign('p', ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many()); if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
$ui->assign('p', ORM::for_table('tbl_plans')->where('type', 'Balance')->find_many());
}else{
$ui->assign('p', ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many());
}
run_hook('view_deposit'); #HOOK run_hook('view_deposit'); #HOOK
$ui->display('deposit.tpl'); $ui->display('deposit.tpl');
break; break;

View File

@ -201,7 +201,7 @@ switch ($action) {
$pool_expired = _post('pool_expired'); $pool_expired = _post('pool_expired');
$list_expired = _post('list_expired'); $list_expired = _post('list_expired');
$enabled = _post('enabled'); $enabled = _post('enabled');
$allow_purchase = _post('allow_purchase'); $prepaid = _post('prepaid');
$msg = ''; $msg = '';
if (Validator::UnsignedNumber($validity) == false) { if (Validator::UnsignedNumber($validity) == false) {
@ -269,7 +269,7 @@ switch ($action) {
$d->pool_expired = $pool_expired; $d->pool_expired = $pool_expired;
$d->list_expired = $list_expired; $d->list_expired = $list_expired;
$d->enabled = $enabled; $d->enabled = $enabled;
$d->allow_purchase = $allow_purchase; $d->prepaid = $prepaid;
$d->save(); $d->save();
$plan_id = $d->id(); $plan_id = $d->id();
@ -309,7 +309,7 @@ switch ($action) {
$pool_expired = _post('pool_expired'); $pool_expired = _post('pool_expired');
$list_expired = _post('list_expired'); $list_expired = _post('list_expired');
$enabled = _post('enabled'); $enabled = _post('enabled');
$allow_purchase = _post('allow_purchase'); $prepaid = _post('prepaid');
$routers = _post('routers'); $routers = _post('routers');
$msg = ''; $msg = '';
if (Validator::UnsignedNumber($validity) == false) { if (Validator::UnsignedNumber($validity) == false) {
@ -374,7 +374,7 @@ switch ($action) {
$d->pool_expired = $pool_expired; $d->pool_expired = $pool_expired;
$d->list_expired = $list_expired; $d->list_expired = $list_expired;
$d->enabled = $enabled; $d->enabled = $enabled;
$d->allow_purchase = $allow_purchase; $d->prepaid = $prepaid;
$d->save(); $d->save();
r2(U . 'services/hotspot', 's', Lang::T('Data Updated Successfully')); r2(U . 'services/hotspot', 's', Lang::T('Data Updated Successfully'));
@ -471,7 +471,7 @@ switch ($action) {
$pool_expired = _post('pool_expired'); $pool_expired = _post('pool_expired');
$list_expired = _post('list_expired'); $list_expired = _post('list_expired');
$enabled = _post('enabled'); $enabled = _post('enabled');
$allow_purchase = _post('allow_purchase'); $prepaid = _post('prepaid');
$msg = ''; $msg = '';
@ -533,7 +533,7 @@ switch ($action) {
$d->pool_expired = $pool_expired; $d->pool_expired = $pool_expired;
$d->list_expired = $list_expired; $d->list_expired = $list_expired;
$d->enabled = $enabled; $d->enabled = $enabled;
$d->allow_purchase = $allow_purchase; $d->prepaid = $prepaid;
$d->save(); $d->save();
$plan_id = $d->id(); $plan_id = $d->id();
@ -566,7 +566,7 @@ switch ($action) {
$pool_expired = _post('pool_expired'); $pool_expired = _post('pool_expired');
$list_expired = _post('list_expired'); $list_expired = _post('list_expired');
$enabled = _post('enabled'); $enabled = _post('enabled');
$allow_purchase = _post('allow_purchase'); $prepaid = _post('prepaid');
$msg = ''; $msg = '';
if (Validator::UnsignedNumber($validity) == false) { if (Validator::UnsignedNumber($validity) == false) {
@ -626,7 +626,7 @@ switch ($action) {
$d->pool_expired = $pool_expired; $d->pool_expired = $pool_expired;
$d->list_expired = $list_expired; $d->list_expired = $list_expired;
$d->enabled = $enabled; $d->enabled = $enabled;
$d->allow_purchase = $allow_purchase; $d->prepaid = $prepaid;
$d->save(); $d->save();
r2(U . 'services/pppoe', 's', Lang::T('Data Updated Successfully')); r2(U . 'services/pppoe', 's', Lang::T('Data Updated Successfully'));
@ -678,7 +678,7 @@ switch ($action) {
$name = _post('name'); $name = _post('name');
$price = _post('price'); $price = _post('price');
$enabled = _post('enabled'); $enabled = _post('enabled');
$allow_purchase = _post('allow_purchase'); $prepaid = _post('prepaid');
$msg = ''; $msg = '';
if (Validator::UnsignedNumber($price) == false) { if (Validator::UnsignedNumber($price) == false) {
@ -698,7 +698,7 @@ switch ($action) {
$d->name_plan = $name; $d->name_plan = $name;
$d->price = $price; $d->price = $price;
$d->enabled = $enabled; $d->enabled = $enabled;
$d->allow_purchase = $allow_purchase; $d->prepaid = 'yes';
$d->save(); $d->save();
r2(U . 'services/balance', 's', Lang::T('Data Updated Successfully')); r2(U . 'services/balance', 's', Lang::T('Data Updated Successfully'));
@ -710,7 +710,6 @@ switch ($action) {
$name = _post('name'); $name = _post('name');
$price = _post('price'); $price = _post('price');
$enabled = _post('enabled'); $enabled = _post('enabled');
$allow_purchase = _post('allow_purchase');
$msg = ''; $msg = '';
if (Validator::UnsignedNumber($price) == false) { if (Validator::UnsignedNumber($price) == false) {
@ -736,7 +735,7 @@ switch ($action) {
$d->routers = ''; $d->routers = '';
$d->pool = ''; $d->pool = '';
$d->enabled = $enabled; $d->enabled = $enabled;
$d->allow_purchase = $allow_purchase; $d->prepaid = 'yes';
$d->save(); $d->save();
r2(U . 'services/balance', 's', Lang::T('Data Created Successfully')); r2(U . 'services/balance', 's', Lang::T('Data Created Successfully'));

View File

@ -468,7 +468,7 @@
"Payment_Gateway_Deleted": "Payment Gateway Deleted", "Payment_Gateway_Deleted": "Payment Gateway Deleted",
"Payment_Gateway_not_set__please_set_it_in_Settings": "Payment Gateway not set, please set it in Settings", "Payment_Gateway_not_set__please_set_it_in_Settings": "Payment Gateway not set, please set it in Settings",
"Failed_to_create_Transaction__": "Failed to create Transaction..", "Failed_to_create_Transaction__": "Failed to create Transaction..",
"Show_To_Customer": "Show To Customer", "Show_To_Customer": "Type",
"Using": "Using", "Using": "Using",
"Default": "Default", "Default": "Default",
"Customer_Balance": "Customer Balance" "Customer_Balance": "Customer Balance"

View File

@ -72,5 +72,8 @@
], ],
"2024.3.3" : [ "2024.3.3" : [
"ALTER TABLE `tbl_plans` CHANGE `validity_unit` `validity_unit` ENUM('Mins','Hrs','Days','Months','Period') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;" "ALTER TABLE `tbl_plans` CHANGE `validity_unit` `validity_unit` ENUM('Mins','Hrs','Days','Months','Period') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;"
],
"2024.3.12" : [
"ALTER TABLE `tbl_plans` CHANGE `allow_purchase` `prepaid` ENUM('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'yes' COMMENT 'is prepaid';"
] ]
} }

View File

@ -1,4 +1,4 @@
<option value="">Select Plans</option> <option value="">Select Plans</option>
{foreach $d as $ds} {foreach $d as $ds}
<option value="{$ds['id']}">{if $ds['enabled'] neq 1}DISABLED PLAN &bull; {/if}{$ds['name_plan']} &bull; {Lang::moneyFormat($ds['price'])}{if $ds['allow_purchase'] neq 'yes'} &bull; HIDDEN PLAN {/if}</option> <option value="{$ds['id']}">{if $ds['enabled'] neq 1}DISABLED PLAN &bull; {/if}{$ds['name_plan']} &bull; {Lang::moneyFormat($ds['price'])}{if $ds['prepaid'] neq 'yes'} &bull; POSTPAID {/if}</option>
{/foreach} {/foreach}

View File

@ -17,17 +17,6 @@
</label> </label>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('')}</label>
<div class="col-md-10">
<label class="radio-inline warning">
<input type="radio" checked name="allow_purchase" value="yes"> Yes
</label>
<label class="radio-inline">
<input type="radio" name="allow_purchase" value="no"> No
</label>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Name')}</label> <label class="col-md-2 control-label">{Lang::T('Plan Name')}</label>
<div class="col-md-6"> <div class="col-md-6">

View File

@ -18,18 +18,6 @@
</label> </label>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Show To Customer')}</label>
<div class="col-md-10">
<label class="radio-inline warning">
<input type="radio" {if $d['allow_purchase'] == yes}checked{/if} name="allow_purchase" value="yes"> Yes
</label>
<label class="radio-inline">
<input type="radio" {if $d['allow_purchase'] == no}checked{/if} name="allow_purchase" value="no">
No
</label>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Name')}</label> <label class="col-md-2 control-label">{Lang::T('Plan Name')}</label>
<div class="col-md-6"> <div class="col-md-6">

View File

@ -21,7 +21,7 @@
data-placeholder="{Lang::T('Select Plans')}..."> data-placeholder="{Lang::T('Select Plans')}...">
<option></option> <option></option>
{foreach $p as $pl} {foreach $p as $pl}
<option value="{$pl['id']}">{$pl['name_plan']} - {Lang::moneyFormat($pl['price'])}</option> <option value="{$pl['id']}">{if $pl['enabled'] neq 1}DISABLED PLAN &bull; {/if}{$pl['name_plan']} - {Lang::moneyFormat($pl['price'])}</option>
{/foreach} {/foreach}
</select> </select>
</div> </div>

View File

@ -14,10 +14,10 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Show To Customer')}</label> <label class="col-md-2 control-label">{Lang::T('Type')}</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="radio" name="allow_purchase" value="yes" checked> Yes <input type="radio" name="prepaid" onclick="prepaid()" value="yes" checked> Prepaid
<input type="radio" name="allow_purchase" value="no"> No <input type="radio" name="prepaid" onclick="postpaid()" value="no"> Postpaid
</div> </div>
</div> </div>
{if $_c['radius_enable']} {if $_c['radius_enable']}
@ -118,17 +118,12 @@
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label> <label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
<div class="col-md-4"> <div class="col-md-4">
<input type="text" class="form-control" id="validity" name="validity"> <input type="text" class="form-control" id="validity" name="validity">
<p class="help-block">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<select class="form-control" id="validity_unit" name="validity_unit"> <select class="form-control" id="validity_unit" name="validity_unit">
<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>
<option value="Period">{Lang::T('Period')}</option>
</select> </select>
</div> </div>
<p class="help-block col-md-4">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div> </div>
<span id="routerChoose" class=""> <span id="routerChoose" class="">
<div class="form-group"> <div class="form-group">
@ -163,8 +158,7 @@
</div> *} </div> *}
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <div class="col-md-offset-2 col-md-10">
<button class="btn btn-success" <button class="btn btn-success" type="submit">{Lang::T('Save Changes')}</button>
type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}services/hotspot">{Lang::T('Cancel')}</a> Or <a href="{$_url}services/hotspot">{Lang::T('Cancel')}</a>
</div> </div>
</div> </div>
@ -173,6 +167,23 @@
</div> </div>
</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);
}
function postpaid() {
$("#validity_unit").html(postOpt);
}
document.addEventListener("DOMContentLoaded", function(event) {
prepaid()
})
</script>
{if $_c['radius_enable']} {if $_c['radius_enable']}
{literal} {literal}
<script> <script>

View File

@ -10,15 +10,18 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Status')}</label> <label class="col-md-2 control-label">{Lang::T('Status')}</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="radio" name="enabled" value="1" {if $d['enabled'] == 1}checked{/if}> Enable <input type="radio" name="enabled" value="1" {if $d['enabled'] == 1}checked{/if}> Enable
<input type="radio" name="enabled" value="0" {if $d['enabled'] == 0}checked{/if}> Disable <input type="radio" name="enabled" value="0" {if $d['enabled'] == 0}checked{/if}> Disable
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Show To Customer')}</label> <label class="col-md-2 control-label">{Lang::T('Type')}</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="radio" name="allow_purchase" value="yes" {if $d['allow_purchase'] == yes}checked{/if}> Yes <input type="radio" name="prepaid" onclick="prepaid()" value="yes"
<input type="radio" name="allow_purchase" value="no" {if $d['allow_purchase'] == no}checked{/if}> No {if $d['prepaid'] == yes}checked{/if}>
Prepaid
<input type="radio" name="prepaid" onclick="postpaid()" value="no"
{if $d['prepaid'] == no}checked{/if}> Postpaid
</div> </div>
</div> </div>
{if $_c['radius_enable'] and $d['is_radius']} {if $_c['radius_enable'] and $d['is_radius']}
@ -128,21 +131,26 @@
<div class="col-md-4"> <div class="col-md-4">
<input type="text" class="form-control" id="validity" name="validity" <input type="text" class="form-control" id="validity" name="validity"
value="{$d['validity']}"> value="{$d['validity']}">
<p class="help-block">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<select class="form-control" id="validity_unit" name="validity_unit"> <select class="form-control" id="validity_unit" name="validity_unit">
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{Lang::T('Mins')} {if $d['prepaid'] == yes}
</option> <option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{Lang::T('Mins')}
<option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{Lang::T('Hrs')} </option>
</option> <option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{Lang::T('Hrs')}
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{Lang::T('Days')} </option>
</option> <option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{Lang::T('Days')}
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}> </option>
{Lang::T('Months')}</option> <option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>
<option value="Period" {if $d['validity_unit'] eq 'Period'} selected {/if}>{Lang::T('Period')}</option> {Lang::T('Months')}</option>
{else}
<option value="Period" {if $d['validity_unit'] eq 'Period'} selected {/if}>
{Lang::T('Period')}</option>
{/if}
</select> </select>
</div> </div>
<p class="help-block col-md-4">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}
</p>
</div> </div>
<span id="routerChoose" class="{if $d['is_radius']}hidden{/if}"> <span id="routerChoose" class="{if $d['is_radius']}hidden{/if}">
<div class="form-group"> <div class="form-group">
@ -176,8 +184,7 @@
</div> *} </div> *}
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <div class="col-md-offset-2 col-md-10">
<button class="btn btn-success" <button class="btn btn-success" type="submit">{Lang::T('Save Changes')}</button>
type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}services/hotspot">{Lang::T('Cancel')}</a> Or <a href="{$_url}services/hotspot">{Lang::T('Cancel')}</a>
</div> </div>
</div> </div>
@ -188,6 +195,21 @@
</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);
}
function postpaid() {
$("#validity_unit").html(postOpt);
}
</script>
{if $_c['radius_enable'] && $d['is_radius']} {if $_c['radius_enable'] && $d['is_radius']}
{literal} {literal}
<script> <script>
@ -215,4 +237,4 @@
</script> </script>
{/literal} {/literal}
{/if} {/if}
{include file="sections/footer.tpl"} {include file="sections/footer.tpl"}

View File

@ -51,7 +51,7 @@
<tbody> <tbody>
{foreach $d as $ds} {foreach $d as $ds}
<tr {if $ds['enabled'] != 1}class="danger" title="disabled" <tr {if $ds['enabled'] != 1}class="danger" title="disabled"
{elseif $ds['allow_purchase'] != 'yes'}class="warning" title="Customer can't purchase" {/if}> {elseif $ds['prepaid'] != 'yes'}class="warning" title="Postpaid" {/if}>
<td class="headcol">{$ds['name_plan']}</td> <td class="headcol">{$ds['name_plan']}</td>
<td>{$ds['typebp']}</td> <td>{$ds['typebp']}</td>
<td>{$ds['name_bw']}</td> <td>{$ds['name_bw']}</td>

View File

@ -14,10 +14,10 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Show To Customer')}</label> <label class="col-md-2 control-label">{Lang::T('Type')}</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="radio" checked name="allow_purchase" value="yes"> Yes <input type="radio" name="prepaid" onclick="prepaid()" value="yes" checked> Prepaid
<input type="radio" name="allow_purchase" value="no"> No <input type="radio" name="prepaid" onclick="postpaid()" value="no"> Postpaid
</div> </div>
</div> </div>
{if $_c['radius_enable']} {if $_c['radius_enable']}
@ -60,17 +60,12 @@
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label> <label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
<div class="col-md-4"> <div class="col-md-4">
<input type="text" class="form-control" id="validity" name="validity"> <input type="text" class="form-control" id="validity" name="validity">
<p class="help-block">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<select class="form-control" id="validity_unit" name="validity_unit"> <select class="form-control" id="validity_unit" name="validity_unit">
<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>
<option value="Period">{Lang::T('Period')}</option>
</select> </select>
</div> </div>
<p class="help-block col-md-4">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label"><a <label class="col-md-2 control-label"><a
@ -121,6 +116,23 @@
</div> </div>
</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);
}
function postpaid() {
$("#validity_unit").html(postOpt);
}
document.addEventListener("DOMContentLoaded", function(event) {
prepaid()
})
</script>
{if $_c['radius_enable']} {if $_c['radius_enable']}
{literal} {literal}
<script> <script>

View File

@ -15,10 +15,11 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Show To Customer')}</label> <label class="col-md-2 control-label">{Lang::T('Type')}</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="radio" name="allow_purchase" value="yes" {if $d['allow_purchase'] == yes}checked{/if}> Yes <input type="radio" name="prepaid" value="yes" {if $d['prepaid'] == yes}checked{/if}>
<input type="radio" name="allow_purchase" value="no" {if $d['allow_purchase'] == no}checked{/if}> No Prepaid
<input type="radio" name="prepaid" value="no" {if $d['prepaid'] == no}checked{/if}> Postpaid
</div> </div>
</div> </div>
{if $_c['radius_enable'] and $d['is_radius']} {if $_c['radius_enable'] and $d['is_radius']}
@ -62,20 +63,25 @@
<div class="col-md-4"> <div class="col-md-4">
<input type="text" class="form-control" id="validity" name="validity" <input type="text" class="form-control" id="validity" name="validity"
value="{$d['validity']}"> value="{$d['validity']}">
<p class="help-block">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<select class="form-control" id="validity_unit" name="validity_unit"> <select class="form-control" id="validity_unit" name="validity_unit">
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{Lang::T('Mins')} {if $d['prepaid'] == yes}
</option> <option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{Lang::T('Mins')}
<option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{Lang::T('Hrs')} </option>
</option> <option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{Lang::T('Hrs')}
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{Lang::T('Days')} </option>
</option> <option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{Lang::T('Days')}
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}> </option>
{Lang::T('Months')}</option> <option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>
<option value="Period" {if $d['validity_unit'] eq 'Period'} selected {/if}>{Lang::T('Period')}</option> {Lang::T('Months')}</option>
{else}
<option value="Period" {if $d['validity_unit'] eq 'Period'} selected {/if}>
{Lang::T('Period')}</option>
{/if}
</select> </select>
<p class="help-block col-md-4">
{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -118,8 +124,7 @@
</div> *} </div> *}
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-2 col-lg-10"> <div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success" <button class="btn btn-success" type="submit">{Lang::T('Save Changes')}</button>
type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}services/pppoe">{Lang::T('Cancel')}</a> Or <a href="{$_url}services/pppoe">{Lang::T('Cancel')}</a>
</div> </div>
</div> </div>
@ -129,6 +134,21 @@
</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);
}
function postpaid() {
$("#validity_unit").html(postOpt);
}
</script>
{if $_c['radius_enable'] && $d['is_radius']} {if $_c['radius_enable'] && $d['is_radius']}
{literal} {literal}
<script> <script>
@ -147,4 +167,4 @@
</script> </script>
{/literal} {/literal}
{/if} {/if}
{include file="sections/footer.tpl"} {include file="sections/footer.tpl"}

View File

@ -49,7 +49,7 @@
<tbody> <tbody>
{foreach $d as $ds} {foreach $d as $ds}
<tr {if $ds['enabled'] != 1}class="danger" title="disabled" <tr {if $ds['enabled'] != 1}class="danger" title="disabled"
{elseif $ds['allow_purchase'] != 'yes'}class="warning" title="Customer can't purchase" {/if}> {elseif $ds['prepaid'] != 'yes'}class="warning" title="Postpaid" {/if}>
<td>{$ds['name_plan']}</td> <td>{$ds['name_plan']}</td>
<td>{$ds['name_bw']}</td> <td>{$ds['name_bw']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td> <td>{Lang::moneyFormat($ds['price'])}</td>

View File

@ -52,6 +52,7 @@
<option value="zero">{$_c['currency_code']} 0</option> <option value="zero">{$_c['currency_code']} 0</option>
</select> </select>
</div> </div>
<p class="help-block col-md-4">Postpaid Recharge for the first time use {$_c['currency_code']} 0</p>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-2 col-lg-10"> <div class="col-lg-offset-2 col-lg-10">

View File

@ -37,36 +37,36 @@
margin-top: 100px; margin-top: 100px;
} }
} }
.loading { .loading {
pointer-events: none; pointer-events: none;
opacity: 0.7; opacity: 0.7;
} }
.loading::after { .loading::after {
content: ""; content: "";
display: inline-block; display: inline-block;
width: 16px; width: 16px;
height: 16px; height: 16px;
vertical-align: middle; vertical-align: middle;
margin-left: 10px; margin-left: 10px;
border: 2px solid #fff; border: 2px solid #fff;
border-top-color: transparent; border-top-color: transparent;
border-radius: 50%; border-radius: 50%;
animation: spin 0.8s infinite linear; animation: spin 0.8s infinite linear;
} }
@keyframes spin { @keyframes spin {
0% { 0% {
transform: rotate(0deg); transform: rotate(0deg);
} }
100% { 100% {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
</style> </style>
{if isset($xheader)} {if isset($xheader)}
{$xheader} {$xheader}
@ -90,7 +90,8 @@
<li class="dropdown user user-menu"> <li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
{if $_c['enable_balance'] == 'yes'} {if $_c['enable_balance'] == 'yes'}
<span style="color: whitesmoke;">&nbsp;{Lang::moneyFormat($_user['balance'])}&nbsp;</span> <span
style="color: whitesmoke;">&nbsp;{Lang::moneyFormat($_user['balance'])}&nbsp;</span>
{else} {else}
<span>{$_user['fullname']}</span> <span>{$_user['fullname']}</span>
{/if} {/if}
@ -107,7 +108,7 @@
<p> <p>
{$_user['fullname']} {$_user['fullname']}
<small>{$_user['phonenumber']}<br> <small>{$_user['phonenumber']}<br>
{$_user['email']}</small> {$_user['email']}</small>
</p> </p>
</li> </li>
<li class="user-body"> <li class="user-body">
@ -197,20 +198,20 @@
{if isset($notify)} {if isset($notify)}
<script> <script>
// Display SweetAlert toast notification // Display SweetAlert toast notification
Swal.fire({ Swal.fire({
icon: '{if $notify_t == "s"}success{else}warning{/if}', icon: '{if $notify_t == "s"}success{else}warning{/if}',
title: '{$notify}', title: '{$notify}',
toast: true, toast: true,
position: 'top-end', position: 'top-end',
showConfirmButton: false, showConfirmButton: false,
timer: 5000, timer: 5000,
timerProgressBar: true, timerProgressBar: true,
didOpen: (toast) => { didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer) toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer) toast.addEventListener('mouseleave', Swal.resumeTimer)
} }
}); });
</script> </script>
{/if} {/if}

View File

@ -148,13 +148,19 @@
{if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['expiration'],$_bill['time'])}{/if}&nbsp; {if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['expiration'],$_bill['time'])}{/if}&nbsp;
</td> </td>
</tr> </tr>
{if $nux_ip} <tr>
<td class="small text-success text-uppercase text-normal">{Lang::T('Type')}</td>
<td class="small mb15 text-success">
<b>{if $_bill['prepaid'] eq yes}Prepaid{else}Postpaid{/if}</b>
</td>
</tr>
{if $nux_ip neq ''}
<tr> <tr>
<td class="small text-primary text-uppercase text-normal">{Lang::T('Current IP')}</td> <td class="small text-primary text-uppercase text-normal">{Lang::T('Current IP')}</td>
<td class="small mb15">{$nux_ip}</td> <td class="small mb15">{$nux_ip}</td>
</tr> </tr>
{/if} {/if}
{if $nux_mac} {if $nux_mac neq ''}
<tr> <tr>
<td class="small text-primary text-uppercase text-normal">{Lang::T('Current MAC')}</td> <td class="small text-primary text-uppercase text-normal">{Lang::T('Current MAC')}</td>
<td class="small mb15">{$nux_mac}</td> <td class="small mb15">{$nux_mac}</td>