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