|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/parasoffline.edukrypt.in/application/modules/admin/views/liveserver/ |
Upload File : |
<?php
if (!empty($this->session->flashdata('msg'))) {
echo $this->session->flashdata('msg');
}
?>
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<!-- header -->
<div class="box-header">
<div class="row">
<div class="col-md-12">
<button class="btn btn-small btn-danger pull-right margin-r-5" id="all_delete">Delete Selected</button>
</div>
<div class="col-md-12" id="filter_msg"></div>
</div>
</div>
<!-- Body -->
<div class="box-body">
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover table-sm" id="check_schedule_list">
<thead style="font-size: 12px;">
<th>
<input type="checkbox" id="all_check_in" value="">
</th>
<th>ID</th>
<th>Server</th>
<th>UserID</th>
<th>ChatID</th>
<th>Username</th>
<th>Chat</th>
<th>Str date</th>
<th>End date</th>
<th>Actions</th>
</thead>
</table>
</div>
</div>
<!-- End -->
</div>
</div>
</div>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/plugins/datatables/dataTables.bootstrap4.min.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/plugins/datatables/responsive.bootstrap4.min.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/plugins/datatables/buttons.bootstrap4.min.css'); ?>">
<script type="text/javascript" src="<?php echo base_url('assets/plugins/datatables/jquery.dataTables.min.js'); ?>">
</script>
<script type="text/javascript" src="<?php echo base_url('assets/plugins/datatables/dataTables.bootstrap4.min.js'); ?>">
</script>
<script type="text/javascript">
$(document).ready(function() {
var dt_tb = $('#check_schedule_list').DataTable({
"processing": true,
"ordering": false,
"serverSide": true,
"pageLength": 50,
"lengthMenu": [
[50, 100, 500],
[50, 100, 500]
],
"ajax": {
"url": JS_BASE_URL + 'admin/liveserver/check_schedule_posts',
"dataType": "JSON",
"type": "POST",
"data": function(post_data) {
post_data.user_id = $("#user_id").val()
},
"beforeSend": function() {
$('#response').fadeIn(100);
},
"complete": function() {
$('#response').fadeOut(100);
},
"async": true,
"error": function(jqXHR, exception) {
console.log(jqXHR.responseText);
}
},
"columns": [{
"data": "id"
},
{
"data": "sid"
},
{
"data": "server"
},
{
"data": "user_id"
},
{
"data": "chat_id"
},
{
"data": "user"
},
{
"data": "chat"
},
{
"data": "str_date"
},
{
"data": "end_date"
},
{
"data": "Actions"
},
]
});
dt_tb.columns().every(function() {
var that = this;
var searchinput = $('#posts_filter').find('input');
$(searchinput, this.footer()).on('change', function() {
if (that.search() !== this.value) {
that.search(this.value).draw();
}
});
});
$(document).on('click', '#get_filter', function() {
dt_tb.draw();
});
$(document).on('click', '#all_check_in', function() {
var all_check_in = $(this),
_check_in = $('._check_in');
if (typeof _check_in !== 'undefined' || _check_in !== null) {
if (all_check_in.prop('checked') == true) {
all_check_in.prop('checked', true);
all_check_in.parent().parent().css({
'background-color': '#000',
'color': '#fff'
});
_check_in.prop('checked', true);
_check_in.parent().parent().css({
'background-color': '#ccc'
});
} else {
all_check_in.prop('checked', false);
all_check_in.parent().parent().removeAttr('style');
_check_in.prop('checked', false);
_check_in.parent().parent().removeAttr('style');
}
}
});
$(document).on('click', '._check_in', function() {
var _check_in = $('._check_in');
_check_in.each(function() {
if ($(this).prop('checked') == true) {
$(this).parent().parent().css({
'background-color': '#ccc'
});
} else {
$(this).parent().parent().removeAttr('style');
}
});
});
$(document).on('click', '#all_delete', function() {
if (confirm("Are you sure you want to delete!") == true) {
var _check_in = $('._check_in'),
lec_msg = $('#lec_msg'),
_selected = [];
if (typeof _check_in !== 'undefined' || _check_in !== null) {
$('._check_in:checked').each(function() {
_selected.push($(this).val());
});
if (_selected.length !== 0) {
$.ajax({
url: JS_BASE_URL + 'admin/liveserver/delete_schedule_all',
type: 'POST',
data: {
id: _selected
},
dataType: 'json',
async: true,
beforeSend: function() {
lec_msg.empty();
lec_msg.append(
'<div class="alert alert-warning" role="alert">Deleting records please wait ...</div>'
);
},
success: function(data) {
if (data) {
if (data.status == 1) {
lec_msg.empty();
window.location.reload(true);
} else {
if (data.redirect_to) {
lec_msg.empty();
window.location.reload(true);
} else {
lec_msg.empty();
lec_msg.append(data.message);
}
}
}
},
error: function(jqXHR, exception) {
console.log(jqXHR.responseText);
}
});
} else {
alert('Select item for delete!');
}
}
}
});
$(document).on('click', '.delete', function() {
if (confirm("Are you sure? you want to delete!")) {
var href = $(this).data('href');
window.location = href;
}
});
});
</script>