bbone/application/modules/User/views/user_list.php

168 lines
5.7 KiB
PHP

<head>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.status-success {
background-color: #c1ffc1;
color: #008000;
border-radius:1px;
font-weight: bold;
width: 300px;
height: 200px;
}
.status-danger {
background-color: #ffb6c1;
color: #ff0000;
border-radius: 1px;
font-weight: bold;
width: 300px;
height: 200px;
}
div.dataTables_wrapper div.dataTables_filter {
margin-top: -30px !important;
}
</style>
</head>
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<h2>User Details </h2>
<ul class="nav navbar-right panel_toolbox">
<?php if(user()->action_permit != 'view' ) { ?>
<a href="<?php echo base_url();?>User/addUser" class="btn btn-sm btn-primary">Add User</a>
<?php } ?>
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Name </th>
<?php if (is_superadmin()) { ?>
<th class="column-title">Company </th>
<?php
} ?>
<th class="column-title">Email </th>
<th class="column-title">Mobile </th>
<th class="column-title" >Role </th>
<th class="column-title" >Permit </th>
<th class="column-title" >status </th>
<th class="column-title" >Action </th>
</tr>
</thead>
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<tr class="even pointer">
<td class=" "> <?php echo $value->name; ?> </td>
<?php if (is_superadmin()) { ?>
<td class=" "> <?php echo $value->business ?> </td>
<?php
} ?>
<td class=" "><?php echo $value->email; ?> </td>
<td class=" "><?php echo $value->mobile; ?></td>
<td class=" "><?php echo $value->role; ?></td>
<td class=" "><?php echo $value->action_permit; ?></td>
<td class=" ">
<?php if ($value->is_active == 1) { ?>
<span class="status-success">Active</span>
<?php } else if ($value->is_active == 0){ ?>
<span class="status-danger">In-active</span>
<?php } ?>
</td>
<td style=" text-align: center; font-size: 16px;">
<?php if ($value->is_active == 1) { ?>
<?php if(user()->action_permit != 'view' ) { ?>
<a href="<?php echo base_url()?>User/editUser/<?php echo md5($value->id);?>" ><i class="fa fa-pencil" title="Edit"></i></a>
&nbsp;
<a href="<?php echo base_url()?>User/deleteUser/<?php echo md5($value->id);?>" >
<i class="fa fa-times-circle-o" aria-hidden="true" style="font-size:20px;" title="deactivate"></i></a>
&nbsp;
<?php } ?>
<!-- <a> <i id="<?php echo md5($value->id);?>" class="bi bi-card-list" title="History"></i></a> -->
<?php } ?>
<?php if ($value->is_active == 0) { ?>
<a href="<?php echo base_url()?>User/activateUser/<?php echo md5($value->id);?>" >
<i class="green fa fa-check-circle" style="font-size:20px;" title="activate"></i></a>
&nbsp;
<!-- <a> <i id="<?php echo md5($value->id);?>" class="bi bi-card-list" title="History"></i></a> -->
&nbsp;
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<br/>
<!-- Large modal -->
<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg" hidden>Large modal</button> -->
<div class="modal fade bs-example-modal-lg" id="ItemModal" tabindex="-1" role="dialog" aria-hidden="true"></div>
<div style="display:none" id="sub-value">
</div>
<script>
$(document).on('click','.bi-card-list',function(){
var id = $(this).attr("id")
$.ajax({
type: "get",
url: "<?php echo base_url()?>User/view_user_history/"+id,
success: function(response) {
response = JSON.parse(response);
console.log(response);
$('.bs-example-modal-lg').html(response);
$('.bs-example-modal-lg').modal("show");
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
});
</script>
<script>
$(document).ready(function() {
$('#datatables').DataTable({
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
buttons: [
{
extend: 'pdfHtml5',
title: 'Users',
text: 'PDF',
customize: function(doc) {
doc.content[1].table.body.forEach(function(row) {
// Remove the first and last columns
row.splice(0, 1);
row.pop();
});
}
},
{
extend: 'excelHtml5',
text: 'Excel',
title: 'Users',
exportOptions: {
columns: ':not(:last-child)'
}
}
]
});
});
</script>