File: /home/barbeatleanalyti/www/m.beatleanalytics.com/application/views/admin/lastWorkIndList.php
<div class="table-responsive">
<table id="example" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead class="thead">
<tr>
<th width="250">IndustryName <i class="fa fa-sort-amount-asc"></i></th>
<th>See All Branch</th>
<th>Add Pages</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody id="hidedata">
<?php
if (empty($allIndustry)){
?>
<tr class="ng-hide">
<td colspan="10"><h1 class="text-center text-muted ng-scope">No Organization</h1><!-- end ngIf: !UsersList.ui.loading --></td>
</tr><!-- ngRepeat: user in UsersList.users track by $index -->
<?php } else {
foreach ($allIndustry as $keyuser=>$valuser){
?>
<tr class="animate-repeat bg-white ng-scope" id="rowid_<?php echo $valuser->IndId;?>">
<td class="ng-binding"><?php echo $valuser->db_industry;?></td>
<td><a class="btn-sm btn btn-success btn-rounded" href="<?php echo base_url();?>index.php/admin/branchList">See All Branch</a></td>
<td><a class="btn-sm btn btn-success btn-rounded getpagdata" data-indname="<?php echo $valuser->db_industry;?>" data-mainindid="<?php echo $valuser->IndId;?>" id="changetextto<?php echo $valuser->IndId;?>" data-toggle="modal" data-target="#myModal" href="javascript:;"><?php if (!empty($valuser->db_pagesId)){ echo 'See All Pages';}else { echo 'Add Pages';}?></a></td>
<td><a class="btn-sm btn btn-success btn-rounded" href="industry/<?php echo $valuser->IndId;?>">Edit</a></td>
<td><a class="btn-sm btn btn-primary btn-rounded deluser" data-uid="<?php echo $valuser->IndId;?>">Delete</a></td>
</tr>
<?php
}
}
?>
</tbody>
<tbody id="showdata">
</tbody>
<!-- Trigger the modal with a button -->
<script>
$(document).ready(function(){
$(".getpagdata").click(function(){
var getpagdata = $(this);
var indname = getpagdata.attr('data-indname');
var mainindid = getpagdata.attr('data-mainindid');
$("#htmlInd").html("Select Pages For "+indname);
$("#mainIndId").val(mainindid);
})
$(".mainManAdd").click(function(){
var mainManAdd = $(this);
var pagemainid = mainManAdd.attr('data-mainid');
var allcheckboxval = '';
if ($("#pagesval_"+pagemainid).is(':checked'))
{
$(":checked").each(function(){
var ischecked = $(this).is(":checked");
if (ischecked)
{
allcheckboxval += $(this).attr('data-mainid') + '|';
}
$("#allval").val(allcheckboxval);
})
}
else
{
//allcheckboxval = $(this).attr('data-mainid');
//$("#allval").remove();
//allcheckboxval -= $(this).attr('data-mainid') + '|';
}
})
});
</script>
<!-- ================ Pages List Modal Start From Here ================= -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title" id="htmlInd"></h4>
</div>
<form action="" method="post" name="addpagesform" id="addpagesform">
<input type="hidden" name="mainIndId" id="mainIndId">
<div class="col-sm-12">
<?php
foreach ($allpages as $keypage=>$valpage)
{
?>
<div style="width:150px; padding:5px; font-size:14px; color:#000; float:left; margin-left:10px;">
<input type="checkbox" name="pagesval_<?php echo $valpage->pageId; ?>" id="pagesval_<?php echo $valpage->pageId; ?>" class="mainManAdd" data-mainid="<?php echo $valpage->pageId;?>"> <?php echo $valpage->db_pagename;?>
</div>
<?php
}
?>
<input type="hidden" name="allval" id="allval">
</div>
<div class="modal-footer">
<button type="button" name="addpagesBtn" id="addpagesBtn" class="btn btn-default" >Save</button>
</div>
</form>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$("#addpagesBtn").click(function(){
var allval = $("#allval").val();
var mainIndId = $("#mainIndId").val();
$.ajax({
type : 'POST',
url : 'addpagesToIndustry',
data : {allval:allval,mainIndId:mainIndId},
success : function(res)
{
$(".close").click();
$("#changetextto"+mainIndId).html('See All Pages');
}
})
})
})
</script>
<tfoot>
<tr><td><!-- ngIf: UsersList.ui.loading --><!-- ngIf: UsersList.ui.lazyLoad --></td><td></td><td></td></tr>
</tfoot>
</table>
</div>