File: /var/www/html/taxicamera/application/views/admin/banner/list.php
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<section class="content-header">
<h1>Manage Banner</h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<a href="<?php echo base_url('admin/banner/add')?>" type="button" class="btn btn-success">Add New Banner<span> <i class="fa fa-banner-plus" aria-hidden="true"></i></span></a>
</div>
<div class="box-body">
<?php if($this->session->flashdata('success_msg')):?>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
<?php echo $this->session->flashdata('success_msg')?>
</div>
<?php endif?>
<?php if($this->session->flashdata('error_msg')):?>
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
<?php echo $this->session->flashdata('error_msg')?>
</div>
<?php endif?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Banner Picture</th>
<th>Name</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<!-- <tr>
<td><img src="images/profile_picture.jpg" alt=""></td>
<td>test</td>
<td>test@testmail.com</td>
<td>123456789</td>
<td>#######</td>
<td>Warehouse Manager</td>
<td><button type="button" class="btn btn-warning2 btn-sm">Active</button></td>
<td><span><a href="edit-banner.html"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a></span> <span><a href="#"><i class="fa fa-trash-o" aria-hidden="true"></i></a></span></td>
</tr>
<tr>
<td><img src="images/profile_picture.jpg" alt=""></td>
<td>test</td>
<td>test@testmail.com</td>
<td>123456789</td>
<td>#######</td>
<td>Supervisor</td>
<td><button type="button" class="btn btn-warning2 btn-sm">Active</button></td>
<td><span><a href="edit-banner.html"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a></span> <span><a href="#"><i class="fa fa-trash-o" aria-hidden="true"></i></a></span></td>
</tr>
<tr>
<td><img src="images/profile_picture.jpg" alt=""></td>
<td>test</td>
<td>test@testmail.com</td>
<td>123456789</td>
<td>#######</td>
<td>Warehouse Manager</td>
<td><button type="button" class="btn btn-warning2 btn-sm">Active</button></td>
<td><span><a href="edit-banner.html"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a></span> <span><a href="#"><i class="fa fa-trash-o" aria-hidden="true"></i></a></span></td>
</tr>
<tr>
<td><img src="images/profile_picture.jpg" alt=""></td>
<td>test</td>
<td>test@testmail.com</td>
<td>123456789</td>
<td>#######</td>
<td>Supervisor</td>
<td><button type="button" class="btn btn-warning2 btn-sm">Active</button></td>
<td><span><a href="edit-banner.html"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a></span> <span><a href="#"><i class="fa fa-trash-o" aria-hidden="true"></i></a></span></td>
</tr> -->
</tbody>
<tfoot>
<tr>
<th>Banner Picture</th>
<th>Name</th>
<th>Status</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<?php /* ?>
<!-- Modal -->
<div class="modal" id='myModal'>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title">Message</h4>
</div>
<div class="modal-body" id='modalContent' title="">
<!-- <p>Would you like to continue ?</p>-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" id="cdel">Ok</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- Modal -->
<?php */ ?>
<script src="<?php echo base_url()?>public/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url()?>public/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script>
$(document).ready(function() {
table = $('#example1').DataTable({
"processing": true, //Feature control the processing indicator.
"serverSide": true, //Feature control DataTables' server-side processing mode.
"order": [], //Initial no order.
// Load data for the table's content from an Ajax source
"ajax": {
"url": "<?php echo site_url('admin/banner/all_content_list')?>",
"type": "POST"
},
//Set column definition initialisation properties.
"columnDefs": [
{
"targets": [ -1 ], //last column
"orderable": false, //set not orderable
},
],
});
$(document).on( "click",'#delete.cstm_view',function() {
$('#modalContent').html('<p>Would you like to continue ?</p>');
var id=$(this).prop('title');
$('#modalContent').attr('title',id);
$('#myModal').modal('show');
});
});
$(document).on( "click",'.banner_status',function() {
var banner_id=$(this).data('id');
$.ajax({
type: "POST",
url: '<?php echo base_url('admin/banner/change_status')?>',
data: 'banner_id='+banner_id,
dataType:'json',
success: function(response){
location.reload();
}
});
});
$(document).on( "click",'#delete',function() {
var banner_id=$(this).data('id');
$.ajax({
type: "POST",
url: '<?php echo base_url('admin/banner/delete')?>',
data: 'banner_id='+banner_id,
dataType:'json',
success: function(response){
location.reload("<?php echo base_url('admin/banner')?>");
}
});
});
</script>