fix pagination Voucher
This commit is contained in:
parent
18bdf185d6
commit
8dc7707b3a
@ -2,6 +2,15 @@
|
|||||||
|
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 2024.4.23
|
||||||
|
|
||||||
|
- Fix Pagination Voucher
|
||||||
|
- Fix Languange Translation
|
||||||
|
- Fix Alert Confirmation for requesting Extend
|
||||||
|
- Send Telegram Notification when Customer request to extend expiration
|
||||||
|
- prepaid users export list by @freeispradius
|
||||||
|
- fix show voucher by @agstrxyz
|
||||||
|
|
||||||
## 2024.4.21
|
## 2024.4.21
|
||||||
|
|
||||||
- Restore old cron
|
- Restore old cron
|
||||||
|
@ -78,75 +78,75 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//case csv-prepaid can be moved later to (plan.php) php file dealing with prepaid users
|
//case csv-prepaid can be moved later to (plan.php) php file dealing with prepaid users
|
||||||
case 'csv-prepaid':
|
case 'csv-prepaid':
|
||||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||||
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
||||||
}
|
}
|
||||||
|
|
||||||
$cs = ORM::for_table('tbl_customers')
|
$cs = ORM::for_table('tbl_customers')
|
||||||
->select('tbl_customers.id', 'id')
|
->select('tbl_customers.id', 'id')
|
||||||
->select('tbl_customers.username', 'username')
|
->select('tbl_customers.username', 'username')
|
||||||
->select('fullname')
|
->select('fullname')
|
||||||
->select('address')
|
->select('address')
|
||||||
->select('phonenumber')
|
->select('phonenumber')
|
||||||
->select('email')
|
->select('email')
|
||||||
->select('balance')
|
->select('balance')
|
||||||
->select('service_type')
|
->select('service_type')
|
||||||
->select('namebp')
|
->select('namebp')
|
||||||
->select('routers')
|
->select('routers')
|
||||||
->select('status')
|
->select('status')
|
||||||
->select('method', 'Payment')
|
->select('method', 'Payment')
|
||||||
->join('tbl_user_recharges', array('tbl_customers.id', '=', 'tbl_user_recharges.customer_id'))
|
->join('tbl_user_recharges', array('tbl_customers.id', '=', 'tbl_user_recharges.customer_id'))
|
||||||
->order_by_asc('tbl_customers.id')
|
->order_by_asc('tbl_customers.id')
|
||||||
->find_array();
|
->find_array();
|
||||||
|
|
||||||
$h = false;
|
$h = false;
|
||||||
set_time_limit(-1);
|
set_time_limit(-1);
|
||||||
header('Pragma: public');
|
header('Pragma: public');
|
||||||
header('Expires: 0');
|
header('Expires: 0');
|
||||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||||
header("Content-type: text/csv");
|
header("Content-type: text/csv");
|
||||||
header('Content-Disposition: attachment;filename="phpnuxbill_prepaid_users' . date('Y-m-d_H_i') . '.csv"');
|
header('Content-Disposition: attachment;filename="phpnuxbill_prepaid_users' . date('Y-m-d_H_i') . '.csv"');
|
||||||
header('Content-Transfer-Encoding: binary');
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
|
||||||
$headers = [
|
$headers = [
|
||||||
'id',
|
'id',
|
||||||
'username',
|
'username',
|
||||||
'fullname',
|
'fullname',
|
||||||
'address',
|
'address',
|
||||||
'phonenumber',
|
'phonenumber',
|
||||||
'email',
|
'email',
|
||||||
'balance',
|
'balance',
|
||||||
'service_type',
|
'service_type',
|
||||||
'namebp',
|
'namebp',
|
||||||
'routers',
|
'routers',
|
||||||
'status',
|
'status',
|
||||||
'Payment'
|
'Payment'
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$h) {
|
||||||
|
echo '"' . implode('","', $headers) . "\"\n";
|
||||||
|
$h = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($cs as $c) {
|
||||||
|
$row = [
|
||||||
|
$c['id'],
|
||||||
|
$c['username'],
|
||||||
|
$c['fullname'],
|
||||||
|
$c['address'],
|
||||||
|
$c['phonenumber'],
|
||||||
|
$c['email'],
|
||||||
|
$c['balance'],
|
||||||
|
$c['service_type'],
|
||||||
|
$c['namebp'],
|
||||||
|
$c['routers'],
|
||||||
|
$c['status'],
|
||||||
|
$c['Payment']
|
||||||
];
|
];
|
||||||
|
echo '"' . implode('","', $row) . "\"\n";
|
||||||
if (!$h) {
|
}
|
||||||
echo '"' . implode('","', $headers) . "\"\n";
|
break;
|
||||||
$h = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($cs as $c) {
|
|
||||||
$row = [
|
|
||||||
$c['id'],
|
|
||||||
$c['username'],
|
|
||||||
$c['fullname'],
|
|
||||||
$c['address'],
|
|
||||||
$c['phonenumber'],
|
|
||||||
$c['email'],
|
|
||||||
$c['balance'],
|
|
||||||
$c['service_type'],
|
|
||||||
$c['namebp'],
|
|
||||||
$c['routers'],
|
|
||||||
$c['status'],
|
|
||||||
$c['Payment']
|
|
||||||
];
|
|
||||||
echo '"' . implode('","', $row) . "\"\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'add':
|
case 'add':
|
||||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Agent', 'Sales'])) {
|
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Agent', 'Sales'])) {
|
||||||
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
||||||
|
@ -132,7 +132,7 @@ switch ($action) {
|
|||||||
$using = _post('using');
|
$using = _post('using');
|
||||||
$stoken = _post('stoken');
|
$stoken = _post('stoken');
|
||||||
|
|
||||||
if(!empty(App::getTokenValue($stoken))){
|
if (!empty(App::getTokenValue($stoken))) {
|
||||||
$username = App::getTokenValue($stoken);
|
$username = App::getTokenValue($stoken);
|
||||||
$in = ORM::for_table('tbl_transactions')->where('username', $username)->order_by_desc('id')->find_one();
|
$in = ORM::for_table('tbl_transactions')->where('username', $username)->order_by_desc('id')->find_one();
|
||||||
Package::createInvoice($in);
|
Package::createInvoice($in);
|
||||||
@ -325,18 +325,13 @@ switch ($action) {
|
|||||||
|
|
||||||
case 'voucher':
|
case 'voucher':
|
||||||
$ui->assign('_title', Lang::T('Vouchers'));
|
$ui->assign('_title', Lang::T('Vouchers'));
|
||||||
$limit = 10;
|
|
||||||
$page = _get('p', 0);
|
|
||||||
$pageNow = $page * $limit;
|
|
||||||
$search = _req('search');
|
$search = _req('search');
|
||||||
if ($search != '') {
|
if ($search != '') {
|
||||||
if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||||
$d = ORM::for_table('tbl_plans')->where('enabled', '1')
|
$query = ORM::for_table('tbl_plans')->where('enabled', '1')
|
||||||
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
||||||
->where_like('tbl_voucher.code', '%' . $search . '%')
|
->where_like('tbl_voucher.code', '%' . $search . '%');
|
||||||
->offset($pageNow)
|
$d = Paginator::findMany($query, ["search" => $search]);
|
||||||
->limit($limit)
|
|
||||||
->findArray();
|
|
||||||
} else if ($admin['user_type'] == 'Agent') {
|
} else if ($admin['user_type'] == 'Agent') {
|
||||||
$sales = [];
|
$sales = [];
|
||||||
$sls = ORM::for_table('tbl_users')->select('id')->where('root', $admin['id'])->findArray();
|
$sls = ORM::for_table('tbl_users')->select('id')->where('root', $admin['id'])->findArray();
|
||||||
@ -344,21 +339,17 @@ switch ($action) {
|
|||||||
$sales[] = $s['id'];
|
$sales[] = $s['id'];
|
||||||
}
|
}
|
||||||
$sales[] = $admin['id'];
|
$sales[] = $admin['id'];
|
||||||
$d = ORM::for_table('tbl_plans')
|
$query = ORM::for_table('tbl_plans')
|
||||||
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
||||||
->where_in('generated_by', $sales)
|
->where_in('generated_by', $sales)
|
||||||
->where_like('tbl_voucher.code', '%' . $search . '%')
|
->where_like('tbl_voucher.code', '%' . $search . '%');
|
||||||
->offset($pageNow)
|
$d = Paginator::findMany($query, ["search" => $search]);
|
||||||
->limit($limit)
|
|
||||||
->findArray();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||||
$d = ORM::for_table('tbl_plans')->where('enabled', '1')
|
$query = ORM::for_table('tbl_plans')->where('enabled', '1')
|
||||||
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'));
|
||||||
->offset($pageNow)
|
$d = Paginator::findMany($query);
|
||||||
->limit($limit)
|
|
||||||
->findArray();
|
|
||||||
} else if ($admin['user_type'] == 'Agent') {
|
} else if ($admin['user_type'] == 'Agent') {
|
||||||
$sales = [];
|
$sales = [];
|
||||||
$sls = ORM::for_table('tbl_users')->select('id')->where('root', $admin['id'])->findArray();
|
$sls = ORM::for_table('tbl_users')->select('id')->where('root', $admin['id'])->findArray();
|
||||||
@ -366,12 +357,10 @@ switch ($action) {
|
|||||||
$sales[] = $s['id'];
|
$sales[] = $s['id'];
|
||||||
}
|
}
|
||||||
$sales[] = $admin['id'];
|
$sales[] = $admin['id'];
|
||||||
$d = ORM::for_table('tbl_plans')
|
$query = ORM::for_table('tbl_plans')
|
||||||
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
||||||
->where_in('generated_by', $sales)
|
->where_in('generated_by', $sales);
|
||||||
->offset($pageNow)
|
$d = Paginator::findMany($query);
|
||||||
->limit($limit)
|
|
||||||
->findArray();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// extract admin
|
// extract admin
|
||||||
@ -581,6 +570,7 @@ switch ($action) {
|
|||||||
} else if ($voucher_format == 'rand') {
|
} else if ($voucher_format == 'rand') {
|
||||||
$code = Lang::randomUpLowCase($code);
|
$code = Lang::randomUpLowCase($code);
|
||||||
}
|
}
|
||||||
|
die($code);
|
||||||
$d = ORM::for_table('tbl_voucher')->create();
|
$d = ORM::for_table('tbl_voucher')->create();
|
||||||
$d->type = $type;
|
$d->type = $type;
|
||||||
$d->routers = $server;
|
$d->routers = $server;
|
||||||
@ -743,15 +733,15 @@ switch ($action) {
|
|||||||
$id = $routes[2];
|
$id = $routes[2];
|
||||||
$days = $routes[3];
|
$days = $routes[3];
|
||||||
$stoken = $_GET['stoken'];
|
$stoken = $_GET['stoken'];
|
||||||
if(App::getTokenValue($stoken)){
|
if (App::getTokenValue($stoken)) {
|
||||||
r2(U . 'plan', 's', "Extend already done");
|
r2(U . 'plan', 's', "Extend already done");
|
||||||
}
|
}
|
||||||
$tur = ORM::for_table('tbl_user_recharges')->find_one($id);
|
$tur = ORM::for_table('tbl_user_recharges')->find_one($id);
|
||||||
$status = $tur['status'];
|
$status = $tur['status'];
|
||||||
if(strtotime($tur['expiration'].' '.$tur['time']) > time()){
|
if (strtotime($tur['expiration'] . ' ' . $tur['time']) > time()) {
|
||||||
// not expired
|
// not expired
|
||||||
$expiration = date('Y-m-d', strtotime($tur['expiration']." +$days day"));
|
$expiration = date('Y-m-d', strtotime($tur['expiration'] . " +$days day"));
|
||||||
}else{
|
} else {
|
||||||
//expired
|
//expired
|
||||||
$expiration = date('Y-m-d', strtotime(" +$days day"));
|
$expiration = date('Y-m-d', strtotime(" +$days day"));
|
||||||
}
|
}
|
||||||
@ -759,7 +749,7 @@ switch ($action) {
|
|||||||
$tur->status = "on";
|
$tur->status = "on";
|
||||||
$tur->save();
|
$tur->save();
|
||||||
App::setToken($stoken, $id);
|
App::setToken($stoken, $id);
|
||||||
if($status=='off'){
|
if ($status == 'off') {
|
||||||
if ($tur['routers'] != 'radius') {
|
if ($tur['routers'] != 'radius') {
|
||||||
$mikrotik = Mikrotik::info($tur['routers']);
|
$mikrotik = Mikrotik::info($tur['routers']);
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{if $ds['status']=='off' && $_c['extend_expired']}
|
{if $ds['status']=='off' && $_c['extend_expired']}
|
||||||
<a href="javascript:extend('{$ds['id']}')"
|
<a href="javascript:extend('{$ds['id']}')"
|
||||||
class="btn btn-info btn-xs">{Lang::T('extend')}</a>
|
class="btn btn-info btn-xs">{Lang::T('Extend')}</a>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -16,31 +16,34 @@
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
|
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<form id="site-search" method="post" action="{$_url}plan/voucher/">
|
<form id="site-search" method="post" action="{$_url}plan/voucher/">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-addon">
|
<div class="input-group-addon">
|
||||||
<span class="fa fa-search"></span>
|
<span class="fa fa-search"></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" name="search" class="form-control" placeholder="{Lang::T('Search by Code Voucher')}..." value="{$search}">
|
<input type="text" name="search" class="form-control"
|
||||||
<div class="input-group-btn">
|
placeholder="{Lang::T('Search by Code Voucher')}..." value="{$search}">
|
||||||
<button class="btn btn-success" type="submit">{Lang::T('Search')}</button>
|
<div class="input-group-btn">
|
||||||
</div>
|
<button class="btn btn-success" type="submit">{Lang::T('Search')}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="btn-group btn-group-justified" role="group">
|
<div class="btn-group btn-group-justified" role="group">
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
<a href="{$_url}plan/add-voucher" class="btn btn-primary btn-block"><i class="ion ion-android-add"></i> {Lang::T('Add Vouchers')}</a>
|
<a href="{$_url}plan/add-voucher" class="btn btn-primary btn-block"><i
|
||||||
</div>
|
class="ion ion-android-add"></i> {Lang::T('Add Vouchers')}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-group btn-group-justified" role="group">
|
</div>
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group btn-group-justified" role="group">
|
||||||
<a href="{$_url}plan/print-voucher" target="print_voucher" class="btn btn-info btn-block"><i class="ion ion-android-print"></i> Print</a>
|
<div class="btn-group" role="group">
|
||||||
</div>
|
<a href="{$_url}plan/print-voucher" target="print_voucher"
|
||||||
</div>
|
class="btn btn-info btn-block"><i class="ion ion-android-print"></i> Print</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="datatable" class="table table-bordered table-striped table-condensed">
|
<table id="datatable" class="table table-bordered table-striped table-condensed">
|
||||||
@ -82,8 +85,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{if $ds['status'] neq '1'}
|
{if $ds['status'] neq '1'}
|
||||||
<a href="{$_url}plan/voucher-view/{$ds['id']}" id="{$ds['id']}"
|
<a href="{$_url}plan/voucher-view/{$ds['id']}" id="{$ds['id']}" style="margin: 0px;"
|
||||||
style="margin: 0px;"
|
|
||||||
class="btn btn-success btn-xs"> {Lang::T('View')} </a>
|
class="btn btn-success btn-xs"> {Lang::T('View')} </a>
|
||||||
{/if}
|
{/if}
|
||||||
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
|
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "2024.4.21"
|
"version": "2024.4.23"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user