Remove Datatables in customer list
This commit is contained in:
parent
509658be9c
commit
46a4c5f24d
@ -655,6 +655,8 @@ switch ($action) {
|
|||||||
'status' => 7
|
'status' => 7
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$append_url = "&order=" . urlencode($order) . "&filter=" . urlencode($filter) . "&orderby=" . urlencode($orderby);
|
||||||
|
|
||||||
if ($search != '') {
|
if ($search != '') {
|
||||||
$query = ORM::for_table('tbl_customers')
|
$query = ORM::for_table('tbl_customers')
|
||||||
->whereRaw("username LIKE '%$search%' OR fullname LIKE '%$search%' OR address LIKE '%$search%' " .
|
->whereRaw("username LIKE '%$search%' OR fullname LIKE '%$search%' OR address LIKE '%$search%' " .
|
||||||
@ -668,8 +670,8 @@ switch ($action) {
|
|||||||
} else {
|
} else {
|
||||||
$query->order_by_desc($order);
|
$query->order_by_desc($order);
|
||||||
}
|
}
|
||||||
$d = $query->findMany();
|
|
||||||
if (_post('export', '') == 'csv') {
|
if (_post('export', '') == 'csv') {
|
||||||
|
$d = $query->findMany();
|
||||||
$h = false;
|
$h = false;
|
||||||
set_time_limit(-1);
|
set_time_limit(-1);
|
||||||
header('Pragma: public');
|
header('Pragma: public');
|
||||||
@ -710,6 +712,7 @@ switch ($action) {
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
$d = Paginator::findMany($query, ['search' => $search], 30, $append_url);
|
||||||
$ui->assign('xheader', '<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css">');
|
$ui->assign('xheader', '<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css">');
|
||||||
$ui->assign('d', $d);
|
$ui->assign('d', $d);
|
||||||
$ui->assign('statuses', ORM::for_table('tbl_customers')->getEnum("status"));
|
$ui->assign('statuses', ORM::for_table('tbl_customers')->getEnum("status"));
|
||||||
|
@ -33,16 +33,22 @@
|
|||||||
<div class="row row-no-gutters">
|
<div class="row row-no-gutters">
|
||||||
<div class="col-xs-8">
|
<div class="col-xs-8">
|
||||||
<select class="form-control" id="order" name="order">
|
<select class="form-control" id="order" name="order">
|
||||||
<option value="username" {if $order eq 'username' }selected{/if}>{Lang::T('Username')}</option>
|
<option value="username" {if $order eq 'username' }selected{/if}>
|
||||||
<option value="created_at" {if $order eq 'created_at' }selected{/if}>{Lang::T('Created Date')}</option>
|
{Lang::T('Username')}</option>
|
||||||
<option value="balance" {if $order eq 'balance' }selected{/if}>{Lang::T('Balance')}</option>
|
<option value="created_at" {if $order eq 'created_at' }selected{/if}>
|
||||||
<option value="status" {if $order eq 'status' }selected{/if}>{Lang::T('Status')}</option>
|
{Lang::T('Created Date')}</option>
|
||||||
|
<option value="balance" {if $order eq 'balance' }selected{/if}>
|
||||||
|
{Lang::T('Balance')}</option>
|
||||||
|
<option value="status" {if $order eq 'status' }selected{/if}>
|
||||||
|
{Lang::T('Status')}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-4">
|
<div class="col-xs-4">
|
||||||
<select class="form-control" id="orderby" name="orderby">
|
<select class="form-control" id="orderby" name="orderby">
|
||||||
<option value="asc" {if $orderby eq 'asc' }selected{/if}>{Lang::T('Ascending')}</option>
|
<option value="asc" {if $orderby eq 'asc' }selected{/if}>
|
||||||
<option value="desc" {if $orderby eq 'desc' }selected{/if}>{Lang::T('Descending')}</option>
|
{Lang::T('Ascending')}</option>
|
||||||
|
<option value="desc" {if $orderby eq 'desc' }selected{/if}>
|
||||||
|
{Lang::T('Descending')}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -53,7 +59,8 @@
|
|||||||
<span class="input-group-addon">Status</span>
|
<span class="input-group-addon">Status</span>
|
||||||
<select class="form-control" id="filter" name="filter">
|
<select class="form-control" id="filter" name="filter">
|
||||||
{foreach $statuses as $status}
|
{foreach $statuses as $status}
|
||||||
<option value="{$status}" {if $filter eq $status }selected{/if}>{Lang::T($status)}</option>
|
<option value="{$status}" {if $filter eq $status }selected{/if}>{Lang::T($status)}
|
||||||
|
</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -66,17 +73,18 @@
|
|||||||
<input type="text" name="search" class="form-control"
|
<input type="text" name="search" class="form-control"
|
||||||
placeholder="{Lang::T('Search')}..." value="{$search}">
|
placeholder="{Lang::T('Search')}..." value="{$search}">
|
||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
<button class="btn btn-primary" type="submit"><span class="fa fa-search"></span></button>
|
<button class="btn btn-primary" type="submit"><span
|
||||||
|
class="fa fa-search"></span></button>
|
||||||
<button class="btn btn-primary" type="submit" name="export" value="csv">
|
<button class="btn btn-primary" type="submit" name="export" value="csv">
|
||||||
<span class="glyphicon glyphicon-download"
|
<span class="glyphicon glyphicon-download" aria-hidden="true"></span> CSV
|
||||||
aria-hidden="true"></span> CSV
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-1">
|
<div class="col-lg-1">
|
||||||
<a href="{$_url}customers/add" class="btn btn-success text-black btn-block" title="{Lang::T('Add')}">
|
<a href="{$_url}customers/add" class="btn btn-success text-black btn-block"
|
||||||
<i class="ion ion-android-add"></i><i class="glyphicon glyphicon-user"></i>
|
title="{Lang::T('Add')}">
|
||||||
|
<i class="ion ion-android-add"></i><i class="glyphicon glyphicon-user"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -100,7 +108,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{foreach $d as $ds}
|
{foreach $d as $ds}
|
||||||
<tr {if $ds['status'] != 'Active'}class="danger"{/if}>
|
<tr {if $ds['status'] != 'Active'}class="danger" {/if}>
|
||||||
<td onclick="window.location.href = '{$_url}customers/view/{$ds['id']}'"
|
<td onclick="window.location.href = '{$_url}customers/view/{$ds['id']}'"
|
||||||
style="cursor:pointer;">{$ds['username']}</td>
|
style="cursor:pointer;">{$ds['username']}</td>
|
||||||
<td>{$ds['account_type']}</td>
|
<td>{$ds['account_type']}</td>
|
||||||
@ -110,7 +118,8 @@
|
|||||||
<td align="center">
|
<td align="center">
|
||||||
{if $ds['phonenumber']}
|
{if $ds['phonenumber']}
|
||||||
<a href="tel:{$ds['phonenumber']}" class="btn btn-default btn-xs"
|
<a href="tel:{$ds['phonenumber']}" class="btn btn-default btn-xs"
|
||||||
title="{$ds['phonenumber']}"><i class="glyphicon glyphicon-earphone"></i></a>
|
title="{$ds['phonenumber']}"><i
|
||||||
|
class="glyphicon glyphicon-earphone"></i></a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $ds['email']}
|
{if $ds['email']}
|
||||||
<a href="mailto:{$ds['email']}" class="btn btn-default btn-xs"
|
<a href="mailto:{$ds['email']}" class="btn btn-default btn-xs"
|
||||||
@ -135,7 +144,7 @@
|
|||||||
<a href="{$_url}customers/edit/{$ds['id']}" id="{$ds['id']}"
|
<a href="{$_url}customers/edit/{$ds['id']}" id="{$ds['id']}"
|
||||||
style="margin: 0px; color:black"
|
style="margin: 0px; color:black"
|
||||||
class="btn btn-info btn-xs"> {Lang::T('Edit')} </a>
|
class="btn btn-info btn-xs"> {Lang::T('Edit')} </a>
|
||||||
<a href="{$_url}customers/sync/{$ds['id']}" id="{$ds['id']}"
|
<a href="{$_url}customers/sync/{$ds['id']}" id="{$ds['id']}"
|
||||||
style="margin: 5px; color:black"
|
style="margin: 5px; color:black"
|
||||||
class="btn btn-success btn-xs"> {Lang::T('Sync')} </a>
|
class="btn btn-success btn-xs"> {Lang::T('Sync')} </a>
|
||||||
<a href="{$_url}plan/recharge/{$ds['id']}" id="{$ds['id']}" style="margin: 0px;"
|
<a href="{$_url}plan/recharge/{$ds['id']}" id="{$ds['id']}" style="margin: 0px;"
|
||||||
@ -146,27 +155,9 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
{include file="pagination.tpl"}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{include file="sections/footer.tpl"}
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
|
|
||||||
<script>
|
|
||||||
var $j = jQuery.noConflict();
|
|
||||||
|
|
||||||
$j(document).ready(function() {
|
|
||||||
$j('#customerTable').DataTable({
|
|
||||||
order: [[{$order_pos}, '{$orderby}']],
|
|
||||||
"pagingType": "full_numbers",
|
|
||||||
"lengthMenu": [
|
|
||||||
[5, 10, 25, 50, 100, -1],
|
|
||||||
[5, 10, 25, 50, 100, "All"]
|
|
||||||
],
|
|
||||||
"pageLength": 25
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{include file="sections/footer.tpl"}
|
|
Loading…
x
Reference in New Issue
Block a user