Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
b0cb79eeac | |||
95a8eaeadb | |||
aab2282e78 | |||
609cf4b69d | |||
84cd66ea9a | |||
3142e93d52 | |||
6102637d7b |
@ -2,6 +2,15 @@
|
||||
|
||||
# CHANGELOG
|
||||
|
||||
## 2023.9.15
|
||||
|
||||
- Fix Customer balance header
|
||||
- Deactivate Customer active plan
|
||||
- Sync Customer Plan to Mikrotik
|
||||
- Recharge Customer from Customer Details
|
||||
|
||||
## 2023.9.13
|
||||
|
||||
- add Current balance in notification
|
||||
- Buy Plan for Friend
|
||||
- Recharge Friend plan
|
||||
|
@ -32,7 +32,7 @@ switch ($action) {
|
||||
} else {
|
||||
$paginator = Paginator::bootstrap('tbl_customers');
|
||||
$d = ORM::for_table('tbl_customers')
|
||||
->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||
->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||
}
|
||||
|
||||
$ui->assign('search', htmlspecialchars($search));
|
||||
@ -45,13 +45,67 @@ switch ($action) {
|
||||
run_hook('view_add_customer'); #HOOK
|
||||
$ui->display('customers-add.tpl');
|
||||
break;
|
||||
|
||||
case 'recharge':
|
||||
$id_customer = $routes['2'];
|
||||
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
|
||||
if ($b) {
|
||||
$mikrotik = Mikrotik::info($b['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if (Package::rechargeUser($id_customer, $b['routers'], $b['plan_id'], "Recharge", $admin['fullname'])) {
|
||||
r2(U . 'customers/view/' . $id_customer, 's', 'Success Recharge Customer');
|
||||
} else {
|
||||
r2(U . 'customers/view/' . $id_customer, 'e', 'Customer plan is inactive');
|
||||
}
|
||||
}
|
||||
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
|
||||
case 'deactivate':
|
||||
$id_customer = $routes['2'];
|
||||
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
|
||||
if ($b) {
|
||||
$mikrotik = Mikrotik::info($b['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if ($b['type'] == 'Hotspot') {
|
||||
Mikrotik::removeHotspotUser($client, $b['username']);
|
||||
Mikrotik::removeHotspotActiveUser($client, $b['username']);
|
||||
} else if ($b['type'] == 'PPPOE') {
|
||||
Mikrotik::removePpoeUser($client, $b['username']);
|
||||
Mikrotik::removePpoeActive($client, $b['username']);
|
||||
}
|
||||
$b->status = 'off';
|
||||
$b->expiration = date('Y-m-d');
|
||||
$b->time = date('H:i:s');
|
||||
$b->save();
|
||||
r2(U . 'customers/view/' . $id_customer, 's', 'Success deactivate customer to Mikrotik');
|
||||
}
|
||||
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
|
||||
break;
|
||||
case 'sync':
|
||||
$id_customer = $routes['2'];
|
||||
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->where('status', 'on')->find_one();
|
||||
if ($b) {
|
||||
$mikrotik = Mikrotik::info($b['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$c = ORM::for_table('tbl_customers')->find_one($id_customer);
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->where('enabled', '1')->find_one();
|
||||
if ($p) {
|
||||
if ($b['type'] == 'Hotspot') {
|
||||
Mikrotik::addHotspotUser($client, $p, $c);
|
||||
} else if ($b['type'] == 'PPPOE') {
|
||||
Mikrotik::addPpoeUser($client, $p, $c);
|
||||
}
|
||||
r2(U . 'customers/view/' . $id_customer, 's', 'Success sync customer to Mikrotik');
|
||||
} else {
|
||||
r2(U . 'customers/view/' . $id_customer, 'e', 'Customer plan is inactive');
|
||||
}
|
||||
}
|
||||
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
|
||||
break;
|
||||
case 'viewu':
|
||||
$customer = ORM::for_table('tbl_customers')->where('username', $routes['2'])->find_one();
|
||||
case 'view':
|
||||
$id = $routes['2'];
|
||||
run_hook('view_customer'); #HOOK
|
||||
if(!$customer){
|
||||
if (!$customer) {
|
||||
$customer = ORM::for_table('tbl_customers')->find_one($id);
|
||||
}
|
||||
if ($customer) {
|
||||
@ -79,7 +133,7 @@ switch ($action) {
|
||||
// $ui->assign('paginator', $paginator);
|
||||
$ui->assign('activation', $activation);
|
||||
}
|
||||
$package = ORM::for_table('tbl_user_recharges')->where('username',$customer['username'])->find_one();
|
||||
$package = ORM::for_table('tbl_user_recharges')->where('username', $customer['username'])->find_one();
|
||||
$ui->assign('package', $package);
|
||||
$ui->assign('v', $v);
|
||||
$ui->assign('d', $customer);
|
||||
|
@ -160,7 +160,7 @@ switch ($action) {
|
||||
->where('status', 'on')
|
||||
->find_one();
|
||||
|
||||
if ($active['plan_id'] != $plan['id']) {
|
||||
if ($active && $active['plan_id'] != $plan['id']) {
|
||||
r2(U . "order/package", 'e', Lang::T("Target has active plan, different with current plant.")." [ <b>$active[namebp]</b> ]");
|
||||
}
|
||||
if (Package::rechargeUser($target['id'], $plan['routers'], $plan['id'], $user['fullname'], 'Balance')) {
|
||||
|
@ -42,7 +42,7 @@ require_once 'system/autoload/PEAR2/Autoload.php';
|
||||
switch ($action) {
|
||||
case 'list':
|
||||
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/prepaid.js"></script>');
|
||||
|
||||
$ui->assign('_title', $_L['Customers']);
|
||||
$username = _post('username');
|
||||
if ($username != '') {
|
||||
$paginator = Paginator::bootstrap('tbl_user_recharges', 'username', '%' . $username . '%');
|
||||
@ -65,6 +65,9 @@ switch ($action) {
|
||||
$ui->assign('p', $p);
|
||||
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
if(isset($routes['2']) && !empty($routes['2'])){
|
||||
$ui->assign('cust', ORM::for_table('tbl_customers')->find_one($routes['2']));
|
||||
}
|
||||
run_hook('view_recharge'); #HOOK
|
||||
$ui->display('recharge.tpl');
|
||||
break;
|
||||
|
@ -399,4 +399,6 @@ $_L['Target_has_active_plan_different_with_current_plant'] = 'Target has active
|
||||
$_L['Recharge_a_friend'] = 'Recharge a friend';
|
||||
$_L['Buy_for_friend'] = 'Buy for friend';
|
||||
$_L['Buy_this_for_friend_account'] = 'Buy this for friend account?';
|
||||
$_L['Review_package_before_recharge'] = 'Review package before recharge';
|
||||
$_L['Review_package_before_recharge'] = 'Review package before recharge';
|
||||
$_L['Deactivate'] = 'Deactivate';
|
||||
$_L['Sync'] = 'Sync';
|
||||
|
@ -84,8 +84,24 @@
|
||||
{$package['routers']} <span class="pull-right">{$package['method']}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<a href="{$_url}customers/deactivate/{$d['id']}" id="{$d['id']}"
|
||||
class="btn btn-danger btn-block btn-sm" onclick="return confirm('This will deactivate Customer Plan, and make it expired')">{Lang::T('Deactivate')}</a>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<a href="{$_url}customers/recharge/{$d['id']}" onclick="return confirm('This will extend Customer plan, same as recharge')"
|
||||
class="btn btn-success btn-sm btn-block">{Lang::T('Recharge')}</a>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<a href="{$_url}customers/sync/{$d['id']}" onclick="return confirm('This will sync Customer to Mikrotik?')"
|
||||
class="btn btn-primary btn-sm btn-block">{Lang::T('Sync')}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<a href="{$_url}prepaid/recharge/{$d['id']}" class="btn btn-success btn-sm btn-block mt-1">{Lang::T('Recharge')}</a><br>
|
||||
{/if}
|
||||
<a href="{$_url}customers/list" class="btn btn-primary btn-sm btn-block mt-1">{Lang::T('Back')}</a><br>
|
||||
</div>
|
||||
|
@ -41,7 +41,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $d as $ds}
|
||||
<tr>
|
||||
<tr {if $ds['status']=='off'}class="danger"{/if}>
|
||||
<td><a href="{$_url}customers/viewu/{$ds['username']}">{$ds['username']}</a></td>
|
||||
<td>{$ds['namebp']}</td>
|
||||
<td>{$ds['type']}</td>
|
||||
|
@ -1,53 +1,58 @@
|
||||
{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">{$_L['Recharge_Account']}</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}prepaid/recharge-post" >
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
|
||||
<div class="col-md-6">
|
||||
<select id="personSelect" class="form-control select2" name="id_customer" style="width: 100%" data-placeholder="{$_L['Select_Customer']}...">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Type']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" id="Hot" name="type" value="Hotspot"> {$_L['Hotspot_Plans']}
|
||||
<input type="radio" id="POE" name="type" value="PPPOE"> {$_L['PPPOE_Plans']}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Routers']}</label>
|
||||
<div class="col-md-6">
|
||||
<select id="server" name="server" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Routers']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<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">{$_L['Recharge_Account']}</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}prepaid/recharge-post">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
|
||||
<div class="col-md-6">
|
||||
<select {if $cust}{else}id="personSelect"{/if} class="form-control select2"
|
||||
name="id_customer" style="width: 100%" data-placeholder="{$_L['Select_Customer']}...">
|
||||
{if $cust}
|
||||
<option value="{$cust['id']}">{$cust['username']} • {$cust['fullname']} • {$cust['email']}</option>
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Type']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" id="Hot" name="type" value="Hotspot"> {$_L['Hotspot_Plans']}
|
||||
<input type="radio" id="POE" name="type" value="PPPOE"> {$_L['PPPOE_Plans']}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Routers']}</label>
|
||||
<div class="col-md-6">
|
||||
<select id="server" name="server" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Routers']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
|
||||
<div class="col-md-6">
|
||||
<select id="plan" name="plan" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Plans']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
|
||||
<div class="col-md-6">
|
||||
<select id="plan" name="plan" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Plans']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Recharge']}</button>
|
||||
Or <a href="{$_url}customers/list">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<button class="btn btn-success waves-effect waves-light"
|
||||
type="submit">{$_L['Recharge']}</button>
|
||||
Or <a href="{$_url}customers/list">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include file="sections/footer.tpl"}
|
||||
{include file="sections/footer.tpl"}
|
@ -28,11 +28,12 @@
|
||||
background: yellow;
|
||||
}
|
||||
|
||||
.content-wrapper{
|
||||
.content-wrapper {
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.content-wrapper{
|
||||
.content-wrapper {
|
||||
margin-top: 100px;
|
||||
}
|
||||
}
|
||||
@ -55,23 +56,24 @@
|
||||
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>
|
||||
{if $_c['enable_balance'] == 'yes'}
|
||||
<p class="navbar-text text-white" style="float: inline-start; color: whitesmoke; text-align: center !important;">{Lang::T('Balance')} {Lang::moneyFormat($_user['balance'])}</p>
|
||||
{/if}
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown user user-menu">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
{if $_c['enable_balance'] == 'yes'}
|
||||
<span style="color: whitesmoke;">{Lang::moneyFormat($_user['balance'])}</span>
|
||||
{else}
|
||||
<span>{$_user['fullname']}</span>
|
||||
{/if}
|
||||
<img src="https://robohash.org/{$_user['id']}?set=set3&size=100x100&bgset=bg1"
|
||||
onerror="this.src='system/uploads/user.default.jpg'"
|
||||
class="user-image" alt="User Image">
|
||||
<span class="hidden-xs">{$_user['fullname']}</span>
|
||||
onerror="this.src='system/uploads/user.default.jpg'" class="user-image"
|
||||
alt="User Image">
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="user-header">
|
||||
<img src="https://robohash.org/{$_user['id']}?set=set3&size=100x100&bgset=bg1"
|
||||
onerror="this.src='system/uploads/user.default.jpg'"
|
||||
class="img-circle" alt="User Image">
|
||||
onerror="this.src='system/uploads/user.default.jpg'" class="img-circle"
|
||||
alt="User Image">
|
||||
|
||||
<p>
|
||||
{$_user['fullname']}
|
||||
@ -115,12 +117,12 @@
|
||||
</li>
|
||||
{$_MENU_AFTER_DASHBOARD}
|
||||
{if $_c['disable_voucher'] != 'yes'}
|
||||
<li {if $_system_menu eq 'voucher'}class="active" {/if}>
|
||||
<a href="{$_url}voucher/activation">
|
||||
<i class="fa fa-ticket"></i>
|
||||
<span>{Lang::T('Voucher')}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {if $_system_menu eq 'voucher'}class="active" {/if}>
|
||||
<a href="{$_url}voucher/activation">
|
||||
<i class="fa fa-ticket"></i>
|
||||
<span>{Lang::T('Voucher')}</span>
|
||||
</a>
|
||||
</li>
|
||||
{/if}
|
||||
{if $_c['payment_gateway'] != 'none' or $_c['payment_gateway'] == '' }
|
||||
<li {if $_system_menu eq 'package'}class="active" {/if}>
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "2023.9.13"
|
||||
"version": "2023.9.15"
|
||||
}
|
Reference in New Issue
Block a user