|
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/user/ |
Upload File : |
<?php
if (isset($message)) {
echo '<div class="alert alert-success" role="alert">' . $message . '</div>';
}
if (!empty($this->session->flashdata('message'))) {
echo $this->session->flashdata('message');
}
?>
<style>
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 34px;
height: 20px;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: indianred;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 13px;
width: 13px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked+.slider {
background-color: #30bd4e;
}
input:focus+.slider {
box-shadow: 0 0 1px #30bd4e;
}
input:checked+.slider:before {
-webkit-transform: translateX(13px);
-ms-transform: translateX(13px);
transform: translateX(13px);
}
/* Rounded sliders */
.slider.round {
border-radius: 17px;
}
.slider.round:before {
border-radius: 50%;
}
</style>
<div id="lec_msg"></div>
<div class="row">
<?php if ($p_type == 'list') : ?>
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header">
<form action="<?php echo base_url(); ?>admin/user/index" method="get">
<div class="row">
<!-- Tags -->
<div class="col-md-3">
<select class="form-control" name="tag_id" id="tag_id">
<option value="">--selete-tag--</option>
<?php
if (!empty($tags)) {
foreach ($tags as $tag) {
?>
<option <?php echo isset($_GET['tag_id']) && ($_GET['tag_id'] == $tag->id) ? 'selected' : ''; ?> value="<?php echo $tag->id; ?>"><?php echo $tag->tag; ?></option>
<?php
}
}
?>
</select>
</div>
<!-- User ID -->
<div class="col-md-3">
<div class="form-group">
<input class="form-control" value="<?php echo isset($_GET['user_id']) ? $_GET['user_id'] : ''; ?>" type="text" placeholder="Search By User ID" name="user_id" id="user_id">
</div>
</div>
<div class="col-md-6">
<button class="btn btn-danger pull-right" id="all_delete">Delete Selected</button>
<button class="btn btn-danger pull-right margin-r-5" type="button" id="remove_tags">Remove Tags</button>
<button class="btn btn-instagram pull-right margin-r-5" type="button" id="csv_export">CSV Export</button>
<button class="btn-info btn pull-right margin-r-5" type="button" id="clear_filter">Reset</button>
<button class="btn-success btn pull-right margin-r-5" type="submit" id="get_filter">Filter</button>
</div>
</div>
</form>
</div>
<div class="box-body">
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover table-sm" id="user_list">
<thead style="font-size: 12px;">
<th>
<input type="checkbox" id="all_check_in" value="">
</th>
<th>UserID</th>
<th>RegCode</th>
<th>TAG</th>
<th>Username</th>
<th>password</th>
<th>email/phone</th>
<th>aadharno</th>
<th>registered</th>
<th>active</th>
<!-- <th>token</th> -->
<th>Actions</th>
</thead>
</table>
</div>
</div>
</div>
</div>
<?php endif; ?>
</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/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 upload_lecture_list = $('#user_list').DataTable({
"processing": true,
"serverSide": true,
"pageLength": 50,
"lengthMenu": [
[50, 100, 500, 1000, 5000],
[50, 100, 500, 1000, 5000]
],
"ajax": {
"url": JS_BASE_URL + 'admin/user/check_posts',
"dataType": "json",
"type": "POST",
"data": function(post_data) {
post_data.tag_id = "<?php echo isset($_GET['tag_id']) ? $_GET['tag_id'] : ''; ?>",
post_data.user_id = "<?php echo isset($_GET['user_id']) ? $_GET['user_id'] : ''; ?>"
},
// "success": function(data) {
// console.log(data);
// },
"async": true,
"error": function(jqXHR, exception) {
console.log(jqXHR.responseText);
}
},
"columns": [{
"data": "id"
},
{
"data": "user_id"
},
{
"data": "regcode"
},
{
"data": "tag_id"
},
{
"data": "username"
},
{
"data": "password"
},
{
"data": "email"
},
{
"data": "aadharno"
},
{
"data": "registered"
},
{
"data": "active"
},
{
"data": "actions"
}
],
"columnDefs": [{
"targets": [0, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"orderable": false,
}]
});
upload_lecture_list.columns().every(function() {
var that = this;
var searchinput = $('#user_list_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() {
// alert($('#e_type').find(":selected").val());
upload_lecture_list.draw();
});
$(document).on('change', '.change_status', function() {
if (confirm('Are you sure? you want to change status')) {
var col = $(this).data('col');
var user_id = $(this).data('user_id');
var value = $(this).is(":checked");
var lec_msg = $('#lec_msg');
$.ajax({
url: JS_BASE_URL + 'admin/user/change_status',
type: 'POST',
data: {
col: col,
value: value,
user_id: user_id
},
dataType: 'json',
async: true,
beforeSend: function() {
lec_msg.empty();
lec_msg.append(
'<div class="alert alert-warning" role="alert">Please wait ...</div>'
);
},
success: function(data) {
if (data) {
if (data.status == 1) {
lec_msg.empty();
lec_msg.append(data.message);
} else {
lec_msg.empty();
lec_msg.append(data.message);
}
}
},
error: function(jqXHR, exception) {
console.log(jqXHR.responseText);
}
});
}
});
/**********************************************************************************/
$(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');
}
});
});
// mulitiple tags remove
$(document).on('click', '#remove_tags', function() {
if (confirm('Are you sure? you want to remove Tags from selected users')) {
var _tag_id = $('#tag_id').val();
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());
});
// alert(!_tag_id);
// return false;
if (_selected.length !== 0 && _tag_id) {
$.ajax({
url: JS_BASE_URL + 'admin/user/remove_tags',
type: 'POST',
data: {
tag_id: _tag_id,
user_ids: _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('please select users & tag!');
}
}
}
});
// CSV Export
$(document).on('click', '#csv_export', function() {
if (confirm('Are you sure? you want to CSV Export')) {
var _url = "<?php echo base_url(); ?>admin/user/csv_export";
var _tag_id = $('#tag_id').val();
if (_tag_id) {
_url = _url + "?tag_id=" + _tag_id;
}
window.location = _url;
}
});
// mulitiple
$(document).on('click', '#all_delete', function() {
if (confirm('Are you sure? you want to delete selected users')) {
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/user/delete_all',
type: 'POST',
data: {
user_ids: _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!');
}
}
}
});
// Reset ===================================================
$(document).on('click', '#clear_filter', function() {
window.location = "<?php echo base_url(); ?>admin/user/index";
});
// Single delete
$(document).on('click', '.delete', function() {
return confirm('Are you sure? you want to delete user');
});
});
</script>