File: /home/barbeatleanalyti/www/m.beatleanalytics.com/application/views/beatleAdmin/userlist.php
<?php
include('include/header.php');
$this->load->model('Admin_model');
ini_set('memory_limit', '-1');
?>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function(){
// ================== DELETE USER START FROM HERE ========================
$(".deluser").click(function(){
var txt;
var r = confirm("Would you like to delete this user");
if (r == true)
{
var deluser = $(this);
var id = deluser.attr('data-uid');
var token = 'deleteuser';
$.ajax({
type : 'POST',
url : 'deleteUserById',
data : {id:id,token:token},
success : function(res)
{
//alert(res);
$("#rowid_"+id).hide('500');
}
});
}
else
{
}
});
$("#searchUser").change(function()
{
var usertype = $("#searchUser").val();
$.ajax({
type : 'POST',
url : 'SearchUserByType',
data : {usertype:usertype},
success : function(res)
{
if (res)
{
$("#hidedata").hide();
$("#showdata").html(res);
}
}
});
});
$('#example').DataTable();
});
</script>
<div class="right_col" role="main">
<div class="">
<div class="col-md-12 col-sm-12 col-xs-12">
<!-----------------------new theme--------------------------------->
<div class="new-theme user_list">
<h1>Corporate Customer</h1>
<div class="tab-content">
<div id="home" class="tab-pane fade in active">
<br>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#sub_home">Owner</a></li>
<li><a data-toggle="tab" href="#sub_menu1">Manager</a></li>
<li><a data-toggle="tab" href="#sub_menu2">Line Manager</a></li>
</ul>
<div class="tab-content">
<div id="sub_home" class="tab-pane fade in active">
<h3 style="color: #FFF;font-size: 37px; float: left;">Owner</h3>
<table id="example90" class=" main_table display nowrap" style="width:100%">
<!--<table id="datatable" class="table table-striped new-table "> -->
<thead>
<tr>
<th>Sr.No.</th>
<th>Name</th>
<th>Username</th>
<th>Mobile</th>
<th>Email</th>
<th>Group</th>
<th>Organization</th>
<th>Branch</th>
<th>Ind. Name (Ind. Type)</th>
<th>Login</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (empty($allUser)){
//echo "count ".count($allUser);
?>
<tr class="ng-hide">
<td colspan="13"><h1 class="text-center text-muted ng-scope">No Users</h1><!-- end ngIf: !UsersList.ui.loading --></td>
</tr>
<?php } else {
//echo "<pre>";
//print_r($allUser);
$no=1;
foreach ($allUser as $keyuser=>$valuser){
if ($valuser->db_usertype == 'SU_admin')
{
$usertype = 'admin';
}
else if ($valuser->db_usertype == 'line_manager')
{
$usertype = 'Line Manager';
}
else
{
$usertype = $valuser->db_usertype;
}
if ($valuser->db_usertype != 'SU_admin' and $valuser->db_usertype == 'owner')
{
?>
<tr id="rowid_<?php echo $valuser->userId;?>">
<td class="sr_no"><?php echo $no++;?></td>
<td><?php echo $valuser->db_username;?></td>
<td><?php echo $valuser->db_userLoginName;?></td>
<td><?php echo $valuser->db_phone;?></td>
<td><?php echo $valuser->db_email;?></td>
<td><?php echo $usertype;?></td>
<td>
<?php
$userid = $valuser->userId;
$usertype = $valuser->db_usertype;
$data = $this->Admin_model->getAllOrganizationByUserId($usertype,$userid);
//echo '<pre>'; print_r($data );
if (!empty($data[0]->db_Orgname)){echo $data[0]->db_Orgname;}
?>
</td>
<td><?php
if(($valuser->db_usertype == 'line_manager' || $valuser->db_usertype == 'manager') && $valuser->BranchID != 0) {
$rsData = $this->Admin_model->getBranchName($valuser->BranchID);
echo @$rsData[0]->db_branchName;
}else{
echo '-';
}
//echo $valuser->BranchID;
?></td>
<td><?php
if($valuser->db_usertype == 'line_manager' && $valuser->IndustryID != 0) {
$rsData = $this->Admin_model->getIndustryName($valuser->IndustryID);
echo @$rsData[0]->db_industry;
$rsData1 = $this->Admin_model->fetch_all_ind_type_data(@$rsData[0]->db_ind_type_id);
echo " (".@$rsData1[0]->name.")";
}else
echo '-';
?></td>
<td align="center">
<?php if(!empty($valuser->db_userLoginName)) {?>
<a class="btn btn-success btn-sm" target="_blank" href="<?php echo base_url();?>index.php/beatleAdmin/directlogin/<?php echo $valuser->db_userLoginName;?>"> LOGIN </a>
<!--<form class="form-horizontal" name="fromLogin" id="frmLogin" method="post" action="http://manage.beatleanalytics.com/manage.php?pg=login">
<input type="hidden" name="pg" value="login" id="pg"/>
<input type="hidden" name="acn" value="FetchUserDataToLogin" id="acn"/>
<input type="hidden" name="UserType" id="UserType" value="" />
<input type="hidden" name="UserID" id="userid" value="<?php echo $valuser->db_userLoginName;?>" >
<input type="hidden" name="Password" id="password" value="beatle#4455">
<input type="submit" />
</form> -->
<?php } else { ?>
<?php }?>
</td>
<td>
<ul class="act nav navbar-right panel_toolbox">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="users/<?php echo $valuser->userId;?>">Edit</a>
</li>
<li><a href="javascript:;" class="deluser" data-uid="<?php echo $valuser->userId;?>">Delete</a>
</li>
</ul>
</li>
</li>
</ul></td>
</tr>
<?php
}
}
echo "<h1> Total Owner ".($no-1)."</h1>";
}
?>
</tbody>
</table>
</div>
<div id="sub_menu1" class="tab-pane fade">
<h3 style="color: #FFF;font-size: 37px; float: left;">Manager</h3>
<table id="example90" class=" main_table display nowrap" style="width:100%">
<!--- <table id="datatable" class="table table-striped new-table"> -->
<thead>
<tr>
<th>Sr.No.</th>
<th>Name</th>
<th>Username</th>
<th>Mobile</th>
<th>Email</th>
<th>Group</th>
<th>Organization</th>
<th>Branch</th>
<th>Ind. Name (Ind. Type)</th>
<th>Login</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (empty($allUser)){
?>
<tr class="ng-hide">
<td colspan="13"><h1 class="text-center text-muted ng-scope">No Users</h1><!-- end ngIf: !UsersList.ui.loading --></td>
</tr>
<?php } else {
//echo "<pre>";
//print_r($allUser);
$no=1;
foreach ($allUser as $keyuser=>$valuser){
if ($valuser->db_usertype == 'SU_admin')
{
$usertype = 'admin';
}
else if ($valuser->db_usertype == 'line_manager')
{
$usertype = 'Line Manager';
}
else
{
$usertype = $valuser->db_usertype;
}
if ($valuser->db_usertype != 'SU_admin' and $valuser->db_usertype == 'manager')
{
?>
<tr id="rowid_<?php echo $valuser->userId;?>">
<td class="sr_no"><?php echo $no++;?></td>
<td><?php echo $valuser->db_username;?></td>
<td><?php echo $valuser->db_userLoginName;?></td>
<td><?php echo $valuser->db_phone;?></td>
<td><?php echo $valuser->db_email;?></td>
<td><?php echo $usertype;?></td>
<td>
<?php
$userid = $valuser->userId;
$usertype = $valuser->db_usertype;
$data = $this->Admin_model->getAllOrganizationByUserId($usertype,$userid);
// echo '<pre>'; print_r($data);
if (!empty($data[0]->db_Orgname)){echo $data[0]->db_Orgname;}
?>
</td>
<td><?php
if(($valuser->db_usertype == 'line_manager' || $valuser->db_usertype == 'manager') && $valuser->BranchID != 0) {
$rsData = $this->Admin_model->getBranchName($valuser->BranchID);
echo @$rsData[0]->db_branchName;
}else{
echo '-';
}
//echo $valuser->BranchID;
?></td>
<td><?php
if($valuser->db_usertype == 'line_manager' && $valuser->IndustryID != 0) {
$rsData = $this->Admin_model->getIndustryName($valuser->IndustryID);
echo @$rsData[0]->db_industry;
$rsData1 = $this->Admin_model->fetch_all_ind_type_data(@$rsData[0]->db_ind_type_id);
echo " (".@$rsData1[0]->name.")";
}else
echo '-';
?></td>
<td align="center">
<?php if(!empty($valuser->db_userLoginName)) {?>
<a class="btn btn-success btn-sm" target="_blank" href="<?php echo base_url();?>index.php/beatleAdmin/directlogin/<?php echo $valuser->db_userLoginName;?>"> LOGIN </a>
<!--<form class="form-horizontal" name="fromLogin" id="frmLogin" method="post" action="http://manage.beatleanalytics.com/manage.php?pg=login">
<input type="hidden" name="pg" value="login" id="pg"/>
<input type="hidden" name="acn" value="FetchUserDataToLogin" id="acn"/>
<input type="hidden" name="UserType" id="UserType" value="" />
<input type="hidden" name="UserID" id="userid" value="<?php echo $valuser->db_userLoginName;?>" >
<input type="hidden" name="Password" id="password" value="beatle#4455">
<input type="submit" />
</form> -->
<?php } else { ?>
<?php }?>
</td>
<td>
<ul class="act nav navbar-right panel_toolbox">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="users/<?php echo $valuser->userId;?>">Edit</a>
</li>
<li><a href="javascript:;" class="deluser" data-uid="<?php echo $valuser->userId;?>">Delete</a>
</li>
</ul>
</li>
</li>
</ul></td>
</tr>
<?php
}
}
echo "<h1> Total Manager ".($no-1)."</h1>";
}
?>
</tbody>
</table>
</div>
<div id="sub_menu2" class="tab-pane fade">
<h3 style="color: #FFF;font-size: 37px;float:left;">Line manage</h3>
<table id="example90" class=" main_table display nowrap" style="width:100%">
<!-- <table id="datatable" class="table table-striped new-table main_table display" style="width:100%">-->
<thead>
<tr>
<th>Sr.No.</th>
<th>Name</th>
<th>Username</th>
<th>Mobile</th>
<th>Email</th>
<th>Group</th>
<th>Organization</th>
<th>Branch</th>
<th>Ind. Name (Ind. Type)</th>
<th>Login</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (empty($allUser)){
?>
<tr class="ng-hide">
<td colspan="13"><h1 class="text-center text-muted ng-scope">No Users</h1><!-- end ngIf: !UsersList.ui.loading --></td>
</tr>
<?php } else {
//echo "<pre>";
//print_r($allUser);
$no=1;
foreach ($allUser as $keyuser=>$valuser){
if ($valuser->db_usertype == 'SU_admin')
{
$usertype = 'admin';
}
else if ($valuser->db_usertype == 'line_manager')
{
$usertype = 'Line Manager';
}
else
{
$usertype = $valuser->db_usertype;
}
if ($valuser->db_usertype != 'SU_admin' and $valuser->db_usertype == 'line_manager')
{
?>
<tr id="rowid_<?php echo $valuser->userId;?>">
<td class="sr_no"><?php echo $no++;?></td>
<td><?php echo $valuser->db_username;?></td>
<td><?php echo $valuser->db_userLoginName;?></td>
<td><?php echo $valuser->db_phone;?></td>
<td><?php echo $valuser->db_email;?></td>
<td><?php echo $usertype;?></td>
<td>
<?php
$userid = $valuser->userId;
$usertype = $valuser->db_usertype;
$data = $this->Admin_model->getAllOrganizationByUserId($usertype,$userid);
if (!empty($data[0]->db_Orgname)){echo $data[0]->db_Orgname;}
?>
</td>
<td><?php
if(($valuser->db_usertype == 'line_manager' || $valuser->db_usertype == 'manager') && $valuser->BranchID != 0) {
$rsData = $this->Admin_model->getBranchName($valuser->BranchID);
echo @$rsData[0]->db_branchName;
}else{
echo '-';
}
//echo $valuser->BranchID;
?></td>
<td><?php
if($valuser->db_usertype == 'line_manager' && $valuser->IndustryID != 0) {
$rsData = $this->Admin_model->getIndustryName($valuser->IndustryID);
echo @$rsData[0]->db_industry;
$rsData1 = $this->Admin_model->fetch_all_ind_type_data(@$rsData[0]->db_ind_type_id);
echo " (".@$rsData1[0]->name.")";
}else
echo '-';
?></td>
<td align="center">
<?php if(!empty($valuser->db_userLoginName)) {?>
<a class="btn btn-success btn-sm" target="_blank" href="<?php echo base_url();?>index.php/beatleAdmin/directlogin/<?php echo $valuser->db_userLoginName;?>"> LOGIN </a>
<!--<form class="form-horizontal" name="fromLogin" id="frmLogin" method="post" action="http://manage.beatleanalytics.com/manage.php?pg=login">
<input type="hidden" name="pg" value="login" id="pg"/>
<input type="hidden" name="acn" value="FetchUserDataToLogin" id="acn"/>
<input type="hidden" name="UserType" id="UserType" value="" />
<input type="hidden" name="UserID" id="userid" value="<?php echo $valuser->db_userLoginName;?>" >
<input type="hidden" name="Password" id="password" value="beatle#4455">
<input type="submit" />
</form> -->
<?php } else { ?>
<?php }?>
</td>
<td>
<ul class="act nav navbar-right panel_toolbox">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="users/<?php echo $valuser->userId;?>">Edit</a>
</li>
<li><a href="javascript:;" class="deluser" data-uid="<?php echo $valuser->userId;?>">Delete</a>
</li>
</ul>
</li>
</li>
</ul></td>
</tr>
<?php
}
}
echo "<h1> Total Line Manager ".($no-1)."</h1>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<br>
</div>
<!-----------------------// new theme------------------------------------->
</div>
</div>
<?php include ('include/footer.php'); ?>
<style>
table.dataTable tbody tr {
background-color: #535865;
}
div#example90_info {
color: #fff;
}
.main_table thead tr th, .dataTables_scrollHead {
background-color: #ffffff !IMPORTANT;
color: #383e4c;
}
.main_table tr {
background-color: #383e4c !IMPORTANT;
color: #fff;
}
.main_table tr td {
background-color: #383e4c !IMPORTANT;
color: #fff;
}
ul.pagination .new-theme.user_list ul li.active a {
color: #ffffff !IMPORTANT;
}
div.dataTables_wrapper {
width: 100% !IMPORTANT;
margin: 0 auto;
padding: 0px !IMPORTANT;
}
.dataTables_scrollHeadInner {
padding: 0px !IMPORTANT;
width: 100% !IMPORTANT;
margin: 0 auto !IMPORTANT;
}
table.display.nowrap.dataTable.no-footer {
width: 100% !IMPORTANT;
text-align: center !IMPORTANT;
margin: 0 auto;
padding: 0pc;
}
table.display.nowrap.dataTable.no-footer thead th {
text-align: center;
}
.dataTables_scrollBody {
height: auto !IMPORTANT;
max-height: 500px !IMPORTANT;
}
.dataTables_scroll {
border: 1px solid #909090;
border-radius: 3px;
}
thead tr th:after {
display: none !IMPORTANT;
}
.new-theme.user_list ul.nav.nav-tabs li.active a {color:#000;}
.new-theme.user_list ul li.active a {
color: #070707 !IMPORTANT;
}
.new-theme.user_list ul.pagination li.active a {
color: #ffffff !IMPORTANT;
}
table.dataTable.nowrap th, table.dataTable.nowrap td {
white-space: inherit;
}
</style>
<script>
$(document).ready(function() {
$('.main_table').DataTable( {
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"scrollY": 650,
"scrollX": true
} );
} );
</script>