139 lines
6.3 KiB
PHP
139 lines
6.3 KiB
PHP
<main class="common_margin" id="main">
|
|
<div class="from-group adding-class form-group_lng form-group_full-width ">
|
|
<a href="<?php echo base_url().'add-edit-user/0';?>"><button type="button" class="btn btn-success btn-sm">Add New User</button></a>
|
|
</div>
|
|
<div class="main-wrap">
|
|
|
|
<div class="roles-cover">
|
|
<a href="javascript:history.back()"><button class="btn btn-dark btn-sm">Back</button></a>
|
|
<div class="common-heading">
|
|
<h2>Users</h2>
|
|
<div class="alert alert-success" id="success" style="display:none;">
|
|
<strong>Success!</strong> The user deleted successfully.
|
|
</div>
|
|
|
|
<?php if($this->session->flashdata('success')){?>
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
<p><?php echo $this->session->flashdata('success') ?></p>
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<?php if($this->session->flashdata('danger')){?>
|
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
<p><?php echo $this->session->flashdata('danger') ?></p>
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="subject_r">
|
|
<div class="subject_rsec">
|
|
<div class="">
|
|
<table id="tbl" class="display dataTable table-responsive">
|
|
<thead>
|
|
<tr>
|
|
<th>Sl No</th>
|
|
<th>Full Name</th>
|
|
<th>Email ID</th>
|
|
<th>User Role</th>
|
|
<th>Status</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
if(isset($userList) && !empty($userList))
|
|
{
|
|
$slNo=1;
|
|
foreach($userList as $post)
|
|
{
|
|
?>
|
|
<tr>
|
|
<td><?php echo $slNo;?></td>
|
|
<td><?php echo $post['admin_name'];?></td>
|
|
<td><?php echo $post['email'];?></td>
|
|
<td><?php echo $post['role_name'];?></td>
|
|
<td><?php echo $post['status'];?></td>
|
|
<td>
|
|
<div class="sub_tabbtnsec">
|
|
<a href='<?php echo base_url()."add-edit-user/".$post['id'];?>'>
|
|
<div class="sub_editbtn"><i class="fas fa-pencil-alt"></i></div>
|
|
</a>
|
|
<?php if($post['can_delete']=='Yes'){?>
|
|
<div class="sub_delbtn" onclick='delete_user(<?php echo $post['id'];?>)'>
|
|
<i class="fa fa-trash" aria-hidden="true"></i>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
$slNo++;
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<!--End right-top side-->
|
|
</div>
|
|
<!-- <script src="assets/js/jquery-3.2.1.slim.min.js"></script> -->
|
|
<script src="<?= base_url(); ?>assets-lms/js/jquery-3.4.1.min.js" ></script>
|
|
<script src="<?= base_url(); ?>assets-lms/js/popper.min.js"></script>
|
|
<script src="<?= base_url(); ?>assets-lms/js/bootstrap.min.js"></script>
|
|
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
|
|
<script defer src="<?= base_url(); ?>assets-lms/js/all.js"></script>
|
|
<script defer src="<?= base_url(); ?>assets-lms/js/main.js"></script>
|
|
<script src="<?= base_url(); ?>assets-lms/owl-carousel/js/owl.carousel.min.js"></script>
|
|
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$('.user-drpdown').click(function(){
|
|
$('.drpdown-items').toggle();
|
|
});
|
|
});
|
|
//table js
|
|
$('#tbl').DataTable( {
|
|
"lengthMenu": [[5,10, 25, 50, -1], [5,10, 25, 50, "All"]]
|
|
} );
|
|
//table js end
|
|
</script>
|
|
|
|
<script>
|
|
function delete_user(userId)
|
|
{
|
|
swal({
|
|
title: "Are you sure?",
|
|
text: "Once deleted, you will not be able to recover this user!",
|
|
icon: "warning",
|
|
buttons: true,
|
|
dangerMode: true,
|
|
})
|
|
.then((willDelete) => {
|
|
if (willDelete) {
|
|
$.ajax({
|
|
type: 'post',
|
|
url: '<?= base_url(); ?>LmsAdmin/deleteUserData',
|
|
data: {'id' : userId},
|
|
success: function(result){
|
|
if(result == 1){
|
|
$('#success').show();
|
|
setTimeout(() => { location.reload(); }, 2000);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|