File: /home/barbeatleanalyti/public_html/m.beatleanalytics.com/application/views/admin/branchList.php
<?php
include('include/header.php');
$this->load->model('Admin_model');
?>
<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 id = $(this).attr('data-uid');
//alert(id);
var token = 'deleteuser';
$.ajax({
type : 'POST',
url : 'deleteBranchById',
data : {id:id,token:token},
success : function(res)
{
if (res)
{
$("#rowid_"+id).hide('500');
}
}
});
}
else
{
}
});
$("#searchUser").change(function()
{
var usertype = $("#searchUser").val();
$.ajax({
type : 'POST',
url : 'SearchUserByType',
data : {usertype:usertype},
success : function(res)
{ alert(res);
if (res)
{
$("#hidedata").hide();
$("#showdata").html(res);
}
}
});
});
$('#example').DataTable();
});
</script>
<style>
.error {color:#900;}
</style>
<div class="app-content ng-scope">
<div class="butterbar hide"><span class="bar"></span></div>
<a href="" class="off-screen-toggle hide" data-target=".app-aside"></a>
<div class="ng-scope">
<div class="hbox bg-light ng-scope"><div>
<div style="position: fixed;width: 100%;background: #fff; z-index: 2;height: 42px" class="b-b padder">
<ul class="nav nav-pills nav-sm m-t-xs">
<li><a class="btn btn-info" href="<?php echo base_url();?>index.php/admin/branch">Add New Branch</a></li>
</ul>
</div>
</div>
<div class="wrapper-md">
<div class="m-t-md"></div>
<div class="clearfix"></div>
<div class="m-t-md"></div>
<div class="m-t-xs hbox card-applicant"><!--scrollable-table(watch="UsersList.users" table-offset="400")-->
<div class="panel panel-default">
<div class="panel-heading font-bold">Branch List</div>
<div class="table-responsive">
<table id="example" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead class="thead">
<tr>
<th >Name</th>
<!--<th >type</th>-->
<th >Organization</th>
<th >Location</th>
<th >Manager</th>
<th >Line Manager</th>
<th >Industry</th>
<th >Feedback</th>
<th >Ticket</th>
<th >Edit</th>
<th >Delete</th>
</tr>
</thead>
<tbody id="hidedata">
<?php
if (empty($AllBranch)){
?>
<tr class="ng-hide">
<td colspan="10"><h1 class="text-center text-muted ng-scope">No Branch</h1><!-- end ngIf: !UsersList.ui.loading --></td>
</tr><!-- ngRepeat: user in UsersList.users track by $index -->
<?php } else {
/*echo '<pre>';
print_r($AllBranch);die;*/
foreach ($AllBranch as $keybranch=>$valbranch){
$date = strtotime($valbranch->Branchcreated_date);
$Cdate = date('d,M Y' , $date);
?>
<tr class="animate-repeat bg-white ng-scope" id="rowid_<?php echo $valbranch->branchId;?>">
<td class="ng-binding"><?php echo $valbranch->db_branchName;?></td>
<td class="ng-binding"><?php echo $valbranch->db_Orgname;?></td>
<td class="ng-binding"><?php echo $valbranch->name;?></td>
<!--<td class="ng-binding">
<?php
/*$branchOrgId = $valbranch->db_branchOrg;
$data = $this->Admin_model->getAllOwnerByOrgId($branchOrgId);
echo '<pre>';print_r($data);
echo $data[0]->db_username;*/
?>
</td> -->
<td class="ng-binding"><?php echo $valbranch->db_username;?></td>
<td class="ng-binding" >
<a href="<?php echo base_url();?>index.php/admin/userlist/<?php echo $valbranch->branchId;?>/Lime/B" class="btn-sm btn btn-success btn-rounded" style="background-color:#F55050; border:1px solid #F55050;">
<?php
$branchId = $valbranch->branchId;
$data = $this->Admin_model->getIndustryByBranchId($branchId);
echo count($data);
?>
</a>
</td>
<td class="ng-binding">
<a href="<?php echo base_url();?>index.php/admin/industryList/<?php echo $valbranch->branchId;?>" class="btn-sm btn btn-success btn-rounded" style="background-color:#F55050; border:1px solid #F55050;">
<?php
echo count($data);
?>
</a>
</td>
<td class="ng-binding">
<a href="javascript:;" style="background-color:#F55050; border:1px solid #F55050;" class="btn-sm btn btn-success btn-rounded">
<?php echo count($data);?>
</a>
</td>
<td class="ng-binding">
<a href="javascript:;" class="btn-sm btn btn-success btn-rounded" style="background-color:#F55050; border:1px solid #F55050;">
<?php echo count($data);?>
</a>
</td>
<td><a class="btn-sm btn btn-success btn-rounded" href="<?php echo base_url();?>index.php/admin/branch/<?php echo $valbranch->branchId;?>">Edit</a></td>
<td><a class="btn-sm btn btn-primary btn-rounded deluser" data-uid="<?php echo $valbranch->branchId;?>">Delete</a></td>
</tr>
<?php
}
}
?>
</tbody>
<tbody id="showdata">
</tbody>
<tfoot>
<tr><td><!-- ngIf: UsersList.ui.loading --><!-- ngIf: UsersList.ui.lazyLoad --></td><td></td><td></td></tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- jQuery -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>