View User
This commit is contained in:
parent
1cb5d9236f
commit
46e0f981b0
@ -31,4 +31,22 @@ class Lang
|
||||
return $phone;
|
||||
}
|
||||
}
|
||||
|
||||
public static function dateFormat($date){
|
||||
global $config;
|
||||
return date($config['date_format'], strtotime($date));
|
||||
}
|
||||
|
||||
public static function dateTimeFormat($date){
|
||||
global $config;
|
||||
return date($config['date_format']. ' H:i', strtotime($date));
|
||||
}
|
||||
|
||||
public static function nl2br($text){
|
||||
return nl2br($text);
|
||||
}
|
||||
|
||||
public static function arrayCount($arr){
|
||||
return count($arr);
|
||||
}
|
||||
}
|
||||
|
@ -25,17 +25,17 @@ switch ($action) {
|
||||
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/customers.js"></script>');
|
||||
$search = _post('search');
|
||||
$what = _post('what');
|
||||
if(!in_array($what,['username','fullname','phonenumber','email'])){
|
||||
if (!in_array($what, ['username', 'fullname', 'phonenumber', 'email'])) {
|
||||
$what = 'username';
|
||||
}
|
||||
run_hook('list_customers'); #HOOK
|
||||
if ($search != '') {
|
||||
$paginator = Paginator::bootstrap('tbl_customers', 'username', '%' . $search . '%');
|
||||
$d = ORM::for_table('tbl_customers')
|
||||
->where_like($what, '%' . $search . '%')
|
||||
->offset($paginator['startpoint'])
|
||||
->limit($paginator['limit'])
|
||||
->order_by_desc('id')->find_many();
|
||||
->where_like($what, '%' . $search . '%')
|
||||
->offset($paginator['startpoint'])
|
||||
->limit($paginator['limit'])
|
||||
->order_by_desc('id')->find_many();
|
||||
} else {
|
||||
$paginator = Paginator::bootstrap('tbl_customers');
|
||||
$d = ORM::for_table('tbl_customers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||
@ -53,6 +53,42 @@ switch ($action) {
|
||||
$ui->display('customers-add.tpl');
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
$id = $routes['2'];
|
||||
run_hook('view_customer'); #HOOK
|
||||
$customer = ORM::for_table('tbl_customers')->find_one($id);
|
||||
if ($customer) {
|
||||
$v = $routes['3'];
|
||||
if (empty($v) || $v == 'order') {
|
||||
$v = 'order';
|
||||
// $paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $customer['username']);
|
||||
// print_r($paginator);
|
||||
$order = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $customer['username'])
|
||||
->offset(0)
|
||||
->limit(30)
|
||||
->order_by_desc('id')
|
||||
->find_many();
|
||||
// $ui->assign('paginator', $paginator);
|
||||
$ui->assign('order', $order);
|
||||
}else if($v=='activation'){
|
||||
// $paginator = Paginator::bootstrap('tbl_transactions', 'username', $customer['username']);
|
||||
$activation = ORM::for_table('tbl_transactions')
|
||||
->where('username', $customer['username'])
|
||||
->offset(0)
|
||||
->limit(30)
|
||||
->order_by_desc('id')
|
||||
->find_many();
|
||||
// $ui->assign('paginator', $paginator);
|
||||
$ui->assign('activation', $activation);
|
||||
}
|
||||
$ui->assign('v', $v);
|
||||
$ui->assign('d', $customer);
|
||||
$ui->display('customers-view.tpl');
|
||||
} else {
|
||||
r2(U . 'customers/list', 'e', $_L['Account_Not_Found']);
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
$id = $routes['2'];
|
||||
run_hook('edit_customer'); #HOOK
|
||||
@ -74,22 +110,22 @@ switch ($action) {
|
||||
if ($c) {
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
if(!$config['radius_mode']){
|
||||
if (!$config['radius_mode']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client,$c['username']);
|
||||
Mikrotik::removeHotspotActiveUser($client,$c['username']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removeHotspotActiveUser($client, $c['username']);
|
||||
}
|
||||
} else {
|
||||
if(!$config['radius_mode']){
|
||||
if (!$config['radius_mode']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removePpoeUser($client,$c['username']);
|
||||
Mikrotik::removePpoeActive($client,$c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
Mikrotik::removePpoeActive($client, $c['username']);
|
||||
}
|
||||
}
|
||||
try {
|
||||
$d->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch(Throwable $e){
|
||||
} catch (Throwable $e) {
|
||||
}
|
||||
try {
|
||||
$c->delete();
|
||||
@ -99,12 +135,12 @@ switch ($action) {
|
||||
try {
|
||||
$d->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch(Throwable $e){
|
||||
} catch (Throwable $e) {
|
||||
}
|
||||
try {
|
||||
$c->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch(Throwable $e){
|
||||
} catch (Throwable $e) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,23 +229,23 @@ switch ($action) {
|
||||
if ($c) {
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
if(!$config['radius_mode']){
|
||||
if (!$config['radius_mode']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setHotspotUser($client,$c['username'],$password);
|
||||
Mikrotik::removeHotspotActiveUser($client,$user['username']);
|
||||
Mikrotik::setHotspotUser($client, $c['username'], $password);
|
||||
Mikrotik::removeHotspotActiveUser($client, $user['username']);
|
||||
}
|
||||
|
||||
$d->password = $password;
|
||||
$d->save();
|
||||
} else {
|
||||
if(!$config['radius_mode']){
|
||||
if (!$config['radius_mode']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if(!empty($d['pppoe_password'])){
|
||||
if (!empty($d['pppoe_password'])) {
|
||||
Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']);
|
||||
}else{
|
||||
} else {
|
||||
Mikrotik::setPpoeUser($client, $c['username'], $password);
|
||||
}
|
||||
Mikrotik::removePpoeActive($client,$user['username']);
|
||||
Mikrotik::removePpoeActive($client, $user['username']);
|
||||
}
|
||||
|
||||
$d->password = $password;
|
||||
@ -244,5 +280,5 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
default:
|
||||
r2(U . 'customers/list', 'e', 'action not defined');
|
||||
r2(U . 'customers/list', 'e', 'action not defined');
|
||||
}
|
||||
|
@ -368,3 +368,9 @@ $_L['Invoice_Footer'] = 'Invoice Footer';
|
||||
$_L['Pay_With_Balance'] = 'Pay With Balance';
|
||||
$_L['Pay_this_with_Balance_your_active_package_will_be_overwrite'] = 'Pay this with Balance? your active package will be overwrite';
|
||||
$_L['Success_to_buy_package'] = 'Success to buy package';
|
||||
$_L['Auto_Renewal'] = 'Auto Renewal';
|
||||
$_L['View'] = 'View';
|
||||
$_L['View'] = 'View';
|
||||
$_L['View'] = 'View';
|
||||
$_L['View'] = 'View';
|
||||
$_L['View'] = 'View';
|
||||
|
147
ui/ui/customers-view.tpl
Normal file
147
ui/ui/customers-view.tpl
Normal file
@ -0,0 +1,147 @@
|
||||
{include file="sections/header.tpl"}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-md-4">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body box-profile">
|
||||
<img class="profile-user-img img-responsive img-circle"
|
||||
src="https://robohash.org/{$d['id']}?set=set3&size=100x100&bgset=bg1"
|
||||
onerror="this.src='system/uploads/user.default.jpg'" alt="avatar">
|
||||
|
||||
<h3 class="profile-username text-center">{$d['fullname']}</h3>
|
||||
|
||||
<ul class="list-group list-group-unbordered">
|
||||
<li class="list-group-item">
|
||||
<b>{$_L['Username']}</b> <a class="pull-right">{$d['username']}</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<b>{$_L['Phone_Number']}</b> <a class="pull-right">{$d['phonenumber']}</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<b>{$_L['Email']}</b> <a class="pull-right">{$d['email']}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="text-muted">{Lang::nl2br($d['address'])}</p>
|
||||
<ul class="list-group list-group-unbordered">
|
||||
<li class="list-group-item">
|
||||
<b>{$_L['Password']}</b> <a class="pull-right" style="background-color: black; color:black;"
|
||||
onclick="this.select()">{$d['password']}</a>
|
||||
</li>
|
||||
{if $d['pppoe_password'] != ''}
|
||||
<li class="list-group-item">
|
||||
<b>PPPOE {$_L['Password']}</b> <a class="pull-right"
|
||||
style="background-color: black; color:black;"
|
||||
onclick="this.select()">{$d['pppoe_password']}</a>
|
||||
</li>
|
||||
{/if}
|
||||
<li class="list-group-item">
|
||||
<b>{Lang::T('Balance')}</b> <a class="pull-right">{Lang::moneyFormat($d['balance'])}</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<b>{Lang::T('Auto Renewal')}</b> <a
|
||||
class="pull-right">{if $d['auto_renewal']}yes{else}no{/if}</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<b>{$_L['Created_On']}</b> <a class="pull-right">{Lang::dateTimeFormat($d['created_at'])}</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<b>{Lang::T('Last Login')}</b> <a
|
||||
class="pull-right">{Lang::dateTimeFormat($d['last_login'])}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<a href="{$_url}customers/delete/{$d['id']}" id="{$d['id']}"
|
||||
class="btn btn-danger btn-block btn-sm" onclick="return confirm('{$_L['Delete']}?')"><span
|
||||
class="fa fa-trash"></span></a>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
<a href="{$_url}customers/edit/{$d['id']}"
|
||||
class="btn btn-warning btn-sm btn-block">{$_L['Edit']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8 col-md-8">
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" {if $v=='order'}class="active" {/if}><a
|
||||
href="{$_url}customers/view/{$d['id']}/order">30 {Lang::T('Order History')}</a></li>
|
||||
<li role="presentation" {if $v=='activation'}class="active" {/if}><a
|
||||
href="{$_url}customers/view/{$d['id']}/activation">30 {Lang::T('Activation History')}</a></li>
|
||||
</ul>
|
||||
<div class="table-responsive" style="background-color: white;">
|
||||
<table id="datatable" class="table table-bordered table-striped">
|
||||
{if Lang::arrayCount($activation)}
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{$_L['Username']}</th>
|
||||
<th>{$_L['Plan_Name']}</th>
|
||||
<th>{$_L['Plan_Price']}</th>
|
||||
<th>{$_L['Type']}</th>
|
||||
<th>{$_L['Created_On']}</th>
|
||||
<th>{$_L['Expires_On']}</th>
|
||||
<th>{$_L['Method']}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $activation as $ds}
|
||||
<tr>
|
||||
<td>{$ds['username']}</td>
|
||||
<td>{$ds['plan_name']}</td>
|
||||
<td>{Lang::moneyFormat($ds['price'])}</td>
|
||||
<td>{$ds['type']}</td>
|
||||
<td class="text-success">{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
|
||||
<td class="text-danger">{date($_c['date_format'], strtotime($ds['expiration']))}
|
||||
{$ds['time']}</td>
|
||||
<td>{$ds['method']}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
{/if}
|
||||
{if Lang::arrayCount($order)}
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{$_L['Plan_Name']}</th>
|
||||
<th>{Lang::T('Gateway')}</th>
|
||||
<th>{Lang::T('Routers')}</th>
|
||||
<th>{$_L['Type']}</th>
|
||||
<th>{$_L['Plan_Price']}</th>
|
||||
<th>{$_L['Created_On']}</th>
|
||||
<th>{$_L['Expires_On']}</th>
|
||||
<th>{Lang::T('Date Done')}</th>
|
||||
<th>{$_L['Method']}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $order as $ds}
|
||||
<tr>
|
||||
<td>{$ds['plan_name']}</td>
|
||||
<td>{$ds['gateway']}</td>
|
||||
<td>{$ds['routers']}</td>
|
||||
<td>{$ds['payment_channel']}</td>
|
||||
<td>{Lang::moneyFormat($ds['price'])}</td>
|
||||
<td class="text-primary">{date("{$_c['date_format']} H:i",
|
||||
strtotime($ds['created_date']))}</td>
|
||||
<td class="text-danger">{date("{$_c['date_format']} H:i",
|
||||
strtotime($ds['expired_date']))}</td>
|
||||
<td class="text-success">{if $ds['status']!=1}{date("{$_c['date_format']} H:i",
|
||||
strtotime($ds['paid_date']))}{/if}</td>
|
||||
<td>{if $ds['status']==1}{$_L['UNPAID']}
|
||||
{elseif $ds['status']==2}{$_L['PAID']}
|
||||
{elseif $ds['status']==3}{$_L['FAILED']}
|
||||
{elseif $ds['status']==4}{$_L['CANCELED']}
|
||||
{elseif $ds['status']==5}{$_L['UNKNOWN']}
|
||||
{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
{$paginator['contents']}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include file="sections/footer.tpl"}
|
@ -13,15 +13,17 @@
|
||||
<select name="what">
|
||||
<option value="username" {if $what=='username'}selected{/if}>Username</option>
|
||||
<option value="fullname" {if $what=='fullname'}selected{/if}>Name</option>
|
||||
<option value="phonenumber" {if $what=='phonenumber'}selected{/if}>Phone</option>
|
||||
<option value="phonenumber" {if $what=='phonenumber'}selected{/if}>Phone
|
||||
</option>
|
||||
<option value="email" {if $what=='email'}selected{/if}>Email</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" name="search" value="{$search}" class="form-control"
|
||||
placeholder="{$_L['Search_by_Username']}...">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-success" type="submit"><span class="fa fa-search"></span></button>
|
||||
</div>
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-success" type="submit"><span
|
||||
class="fa fa-search"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -34,6 +36,7 @@
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{$_L['Manage']}</th>
|
||||
<th>{$_L['Username']}</th>
|
||||
<th>{$_L['Full_Name']}</th>
|
||||
<th>{Lang::T('Balance')}</th>
|
||||
@ -41,27 +44,23 @@
|
||||
<th>{$_L['Email']}</th>
|
||||
<th>{$_L['Created_On']}</th>
|
||||
<th>{$_L['Recharge']}</th>
|
||||
<th>{$_L['Manage']}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $d as $ds}
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="{$_url}customers/view/{$ds['id']}" id="{$ds['id']}"
|
||||
class="btn btn-success btn-sm">{Lang::T('View')}</a>
|
||||
</td>
|
||||
<td>{$ds['username']}</td>
|
||||
<td>{$ds['fullname']}</td>
|
||||
<td>{Lang::moneyFormat($ds['balance'])}</td>
|
||||
<td>{$ds['phonenumber']}</td>
|
||||
<td>{$ds['email']}</td>
|
||||
<td>{$ds['created_at']}</td>
|
||||
<td>{Lang::dateTimeFormat($ds['created_at'])}</td>
|
||||
<td align="center"><a href="{$_url}prepaid/recharge-user/{$ds['id']}" id="{$ds['id']}"
|
||||
class="btn btn-primary btn-sm">{$_L['Recharge']}</a></td>
|
||||
<td align="center">
|
||||
<a href="{$_url}customers/edit/{$ds['id']}"
|
||||
class="btn btn-warning btn-sm">{$_L['Edit']}</a>
|
||||
<a href="{$_url}customers/delete/{$ds['id']}" id="{$ds['id']}"
|
||||
class="btn btn-danger btn-sm"
|
||||
onclick="return confirm('{$_L['Delete']}?')">{$_L['Delete']}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
|
Loading…
x
Reference in New Issue
Block a user