Commit 8d3c5cc8 by Phạm Văn Đoan

tối ưu ajax/cms_track/list_track_view.php

parent 0a5c6670
...@@ -32,6 +32,8 @@ class CmsTrack extends CI_Controller ...@@ -32,6 +32,8 @@ class CmsTrack extends CI_Controller
{ {
$data = array(); $data = array();
$fByName = $this->input->post('fByName'); $fByName = $this->input->post('fByName');
$fBySinger = $this->input->post('fBySinger');
$fByComposer = $this->input->post('fByComposer');
$pageId = $this->input->post('pageId'); $pageId = $this->input->post('pageId');
// //
$pageId = ($pageId == 0) ? 1 : $pageId; $pageId = ($pageId == 0) ? 1 : $pageId;
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
<th style="text-align: center">Ảnh</th> <th style="text-align: center">Ảnh</th>
<th style="text-align: center">#ID</th> <th style="text-align: center">#ID</th>
<th style="text-align: center">Tên bài hát</th> <th style="text-align: center">Tên bài hát</th>
<th style="text-align: center">Ca sĩ</th>
<th style="text-align: center">Sáng tác</th>
<th style="text-align: center">Xử lý</th> <th style="text-align: center">Xử lý</th>
</tr> </tr>
</thead> </thead>
...@@ -18,6 +20,8 @@ ...@@ -18,6 +20,8 @@
</td> </td>
<td style="text-align: center">#<?php echo $data['id']; ?></td> <td style="text-align: center">#<?php echo $data['id']; ?></td>
<td style="text-align: left"><?php echo $data['title']; ?></td> <td style="text-align: left"><?php echo $data['title']; ?></td>
<td style="text-align: left"><?php echo $data['singer_list']; ?></td>
<td style="text-align: left"><?php echo $data['composer_list']; ?></td>
<td style="text-align: center"> <td style="text-align: center">
<a href="<?php echo base_url().'backend/cmsTrack/showTrack/'.$data['id']; ?>" title="Xem chi tiết"> <a href="<?php echo base_url().'backend/cmsTrack/showTrack/'.$data['id']; ?>" title="Xem chi tiết">
<i class="ace-icon fa fa-eye bigger-130"></i> <i class="ace-icon fa fa-eye bigger-130"></i>
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<div class="row"> <div class="row">
<?php echo form_open(base_url().'backend/cmsTrack/listTrackAjax'); ?> <?php echo form_open(base_url().'backend/cmsTrack/listTrackAjax'); ?>
<!-- Tìm kiếm theo tên bài hát -->
<div class="col-lg-3"> <div class="col-lg-3">
<input <input
class="form-control" type="text" class="form-control" type="text"
...@@ -30,6 +31,23 @@ ...@@ -30,6 +31,23 @@
id="input-name" id="input-name"
placeholder="Nhập tên bài hát..."/> placeholder="Nhập tên bài hát..."/>
</div> </div>
<!-- Lọc theo thông tin ca sĩ -->
<div class="col-lg-3">
<select class="form-control" name="fBySinger" id="fBySinger">
<option value="-1">Thông tin ca sĩ</option>
<option value="1">Đã cập nhật</option>
<option value="2">Chưa cập nhật</option>
</select>
</div>
<!-- Lọc theo thông tin nhạc sĩ -->
<div class="col-lg-3">
<select class="form-control" name="fByComposer" id="fByComposer">
<option value="-1">Thông tin nhạc sĩ</option>
<option value="1">Đã cập nhật</option>
<option value="2">Chưa cập nhật</option>
</select>
</div>
<div class="col-lg-3"></div>
<div class="col-lg-1"> <div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button> <button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div> </div>
...@@ -62,94 +80,62 @@ ...@@ -62,94 +80,62 @@
loadDataByAjaxFromInput(url); loadDataByAjaxFromInput(url);
}, 250); }, 250);
}); });
loadDataByAjaxFromSelectBox('fBySinger', url);
loadDataByAjaxFromSelectBox('fByComposer', url);
// Xóa bộ lọc // Xóa bộ lọc
$('#delete-filter').click(function(){ $('#delete-filter').click(function(){
$("#input-name").val(''); $("#input-name").val('');
changePagination('0'); $("#fBySinger").val('-1');
$("#fByComposer").val('-1');
changePagination('0', url);
return false; return false;
}); });
changePagination('0');
changePagination('0', url);
}); });
//Ham chung cho cac input //Ham chung cho cac input
function loadDataByAjaxFromInput(url){ function loadDataByAjaxFromInput(url){
$('#data-loading').show(); $('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>'; callAjax(0, url);
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
} }
//Ham chung cho cac SelectBox //Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url){ function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){ $('#'+id).change(function(){
$('#data-loading').show(); $('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>'; callAjax(0, url);
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}); });
} }
function loadDataByAjaxDateRange(dtFrom, dtTo, url){ function loadDataByAjaxDateRange(dtFrom, dtTo, url){
$('#data-loading').show(); $('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>'; callAjax(pageId, url);
var fByName = $("#input-name").val();
// ajax
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
} }
function changePagination(pageId) { function changePagination(pageId, url) {
$('#data-loading').show(); $('#data-loading').show();
callAjax(pageId, url);
}
function callAjax(pageId, url) {
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>'; var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsTrack/listTrackAjax"; ?>';
var fByName = $("#input-name").val(); var fByName = $("#input-name").val();
//Ajax ve bieu do\ var fBySinger = $("#fBySinger").val();
var fByComposer = $("#fByComposer").val();
//Ajax
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: url, url: url,
data: { data: {
csrf_name: csrf_value, csrf_name: csrf_value,
fByName: fByName, fByName: fByName,
fBySinger: fBySinger,
fByComposer: fByComposer,
pageId: pageId pageId: pageId
}, },
dataType: "text", dataType: "text",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment