<?php
include ('../ro_head.php');
//include ('methodlist.php');

//var_dump($_SESSION);

if($_SESSION['level'] != 1){

	header('Location: dashboard.php');

}

?>


<!-- END THEME STYLES -->

<!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="../assets/global/plugins/select2/select2.css"/>
<link rel="stylesheet" type="text/css" href="../assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css"/>


<!-- BEGIN PAGE LEVEL STYLES -->


<script type="text/javascript">
function myFunction(str) {
            
            if (confirm("Do you want to delete this User?") == true) {
                window.location = 'user_crud.php?actionid=remove&id='+str;
            }
            
        }


</script>
<!-- END PAGE LEVEL STYLES -->

<!-- BEGIN CONTAINER -->
<div class="page-container">
<?php include_once("../ro_sidebar.php"); ?>
    <!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
							<h4 class="modal-title">Modal title</h4>
						</div>
						<div class="modal-body">
							 Widget settings form goes here
						</div>
						<div class="modal-footer">
							<button type="button" class="btn blue">Save changes</button>
							<button type="button" class="btn default" data-dismiss="modal">Close</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal-dialog -->
			</div>
			<!-- /.modal -->
			<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			
			<!-- BEGIN PAGE HEADER-->
			<!-- <h3 class="page-title">
			User List <small>All User are here</small>
			</h3> -->
			<!-- END PAGE HEADER-->
			<!-- BEGIN PAGE CONTENT-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN EXAMPLE TABLE PORTLET-->
					<div class="portlet box grey-cascade">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-globe"></i>User Table
							</div>
							<div class="tools">
								<a href="javascript:;" class="collapse">
								</a>
								<!-- <a href="#portlet-config" data-toggle="modal" class="config">
								</a> -->
								<a href="javascript:;" class="reload">
								</a>
								<!-- <a href="javascript:;" class="remove">
								</a> -->
							</div>
						</div>
						<div class="portlet-body">
							
							<table class="table table-striped table-bordered table-hover" id="sample_2">
							<thead>
							<tr>
								
								 			<th style="width:10%">Name</th>
                                            <th style="width:10%">User Name</th>
                                            <th style="width:10%">Email</th>
                                            <th style="width:10%">Assigned Center</th>
                                            <th style="width:35%">Permissions</th>
                                            <th style="width:05%">Status</th>
                                            <th style="width:20%">View detail</th>
							</tr>
							</thead>
							<tbody>
							 <?PHP
                                //$db=DbConnect();
       /* if($_REQUEST['brand']!=NULL && $_REQUEST['subcat1']!=NULL) { 
            
            $rs= mysqli_query($con,"select id, name, code2, desc1, price, image from product where subcatid='$_REQUEST[subcat1]' AND brandid='$_REQUEST[brand]' order by name");
        }
        
        elseif($_REQUEST['brand']!=NULL) { 
            
            $rs= mysqli_query($con,"select id, name, code2, desc1, price, image from product where brandid='$_REQUEST[brand]' order by name");
        }
        
        elseif($_REQUEST['subcat1']!=NULL) { 
            
            $rs= mysqli_query($con,"select id, name, code2, desc1, price, image from product where subcatid='$_REQUEST[subcat1]' order by name");
        }
        
        else {*/ 
            
            //mysql_query ("set character_set_results='utf8'");
            mysqli_query($con,'SET CHARACTER SET utf8');
			mysqli_query($con,"SET SESSION collation_connection ='utf8_general_ci'") or die (mysql_error()); 
            @$rs = mysqli_query($con,"select * from adminusers order by u_id");
        //}
                                //$rs = mysqli_query($con,$sql);

            
                                while(@$row=mysqli_fetch_array($rs)){

                                    echo "<tr class='odd gradeX'>";
                                    //echo "<td><input type='checkbox' id='id[]' name='id[]' value='".$row["id"]."'></td>";
                                    echo "<td>".$row["name"]."</td>";
                                    echo "<td>".$row["u_name"]."</td>";                                   
                                    echo "<td>".$row["u_email"]."</td>";                                   
                                    echo "<td>".get_deliverycenter_name($row["delcenter"],$con)."</td>";
                                    echo "<td>".$row["restrictions"]."</td>";

                                    echo "<td>";

                                    ?>

                                    <?php

                                    	if($row["u_status"]== '1' ){
                                    		echo "<span class='label label-sm label-success'>Active</span>";

                                    	}else{
                                    		echo "<span class='label label-sm label-danger'>inactive</span>";
                                    	}

                                    ?>

                                    <?php

                                    echo "</td>";

                                    echo "<td>                                    
                                    <a href='change-otherpass.php?pid=".$row["u_id"]."' class='btn btn-primary btn-xs' title='Change password'> Change password</a>
                                    <a href='update_user.php?pid=".$row["u_id"]."' class='btn btn-primary btn-xs' title='Edit' data-toggle='tooltip' data-placement='top' data-original-title='Delete'><i class='fa fa-list-alt'></i></a>
                                    <a href='#' class='btn btn-danger btn-xs' onclick='myFunction(".$row["u_id"].")' title='Delete' data-toggle='tooltip' data-placement='top' data-original-title='Delete'><i class='fa fa-list-alt'></i></a>
                                    </td>";
                                    echo "</tr>";

                                }
                                ?>	
								</tbody>
							</table>
						</div>
					</div>
					<!-- END EXAMPLE TABLE PORTLET-->
				</div>
			</div>
				</div>
			</div>
			<!-- END PAGE CONTENT-->
		</div>
	</div>
	<!-- END CONTENT -->
	
	
</div>


<!-- END FOOTER -->
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<?php include_once("../ro_footer.php"); ?>

<!-- END FOOTER -->
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<?php include_once("../ro_js.php"); ?>
<!-- <script src="../assets/global/plugins/jquery.min.js" type="text/javascript"></script> -->

<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<script type="text/javascript" src="../assets/global/plugins/select2/select2.min.js"></script>
<script type="text/javascript" src="../assets/global/plugins/datatables/media/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="../assets/js/table-managed.js" type="text/javascript"></script>
<script>
jQuery(document).ready(function() {       
   Metronic.init(); // init metronic core components
Layout.init(); // init current layout
QuickSidebar.init(); // init quick sidebar
Demo.init(); // init demo features
   TableManaged.init();
});
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>





