<?php
	include("includes/dbconfig.php");
	$pagetitle = "System Users";
	require('includes/applicationtop.php');
	require('includes/applicationmenu.php');
	$results = DB::query("SELECT *from settings order by id");
	
	
	#$results = DB::query("SELECT personnel_details.id, personnel_details.display_name, personnel_details.phone, personnel_details.email, personnel_details.login_name, personnel_details.status, peronnel_role.role_name, shop.full_name, personnel_details.is_loggedin, personnel_details.is_locked, personnel_details.version FROM personnel_details LEFT JOIN shop ON personnel_details.branch = shop.id LEFT JOIN peronnel_role ON personnel_details.role = peronnel_role.id ORDER BY shop.full_name, peronnel_role.role_name, personnel_details.display_name");
	
?>
			<!-- Content Wrapper. Contains page content -->
			<div class="content-wrapper">
				<!-- Content Header (Page header) -->
				<section class="content-header">
					<h1>System Settings</h1>
					<ol class="breadcrumb">
					</ol>
				</section>

				<!-- Main content -->
				<section class="content">
					<div class="card card-primary">
						<?php
							if($_SESSION["connectedusergroup"] == 1)
							{
						?>
						<div class="card-header with-border text-center">
							<h3 class="card-title">System Settings List</h3>
						</div>
						
						<div class="card-body">
							<div id="servererrormessage">
							</div>
							
							<div class="card-body table-responsive no-padding">	
								 
								
								<table id="example1"   class="table table-bordered table-striped">
									<thead>
										<tr>
											<th>Name</th>
											<th>Code</th>
											<th>Set Percentage%</th>
											<th>Details</th>
											
											 
											<th class="text-center">Action</th>
										</tr>
									</thead>
									<tfoot>
										<tr>
											<th>Name</th>
											<th>Code</th>
											<th>Set Percentage%</th>
											<th>Details</th>
											
											 
											<th class="text-center">Action</th>
										</tr>
									</tfoot>
									<tbody>
									<?php
										foreach($results as $user)
										{
									?>
										<tr>
											<td><?php echo $user['name']; ?></td>
											<td><?php echo $user['code']; ?></td>
											<td><?php echo $user['value']; ?> %</td>
											<td><?php echo $user['information']; ?></td>
											 <td class="text-center">
												<a href="javascript:void(0);" onclick="gendawano('update_settings', 'userfocus', <?php echo $user['id']; ?>)" data-toggle="tooltip" title="Edit Setting" class="tooltips"><span class="label label-primary" ><i class="fa fa-edit"></i></span></a>
												 
											</td>
										</tr>
									<?php
										}
									?>
									</tbody>
								</table>
							</div>
						</div>
						<?php
							}
							else
							{
						?>
						<div class="alert alert-danger alert-dismissable">
							<i class="fa fa-ban-circle"></i><br>
							Limited Access
						</div>
						<?php
							}
						?>
					</div>
				</section><!-- /.content -->
			</div><!-- /.content-wrapper -->
 
		</div><!-- ./wrapper -->
		
		<div class="modal" id="waitdialogmodal"  data-backdrop="static">
            <div class="modal-dialog modal-sm">
              <div class="modal-content">
                  <div class="modal-body">
					<div class="text-center">
						<img src="<?php echo $base_url . $ajax_loading_image; ?>" />
					</div>
				  </div>
              </div>
            </div>
        </div>

		 <?php include ('includes/general_footer.php')?>
		
		<script src="plugins/bert/storepos.js" type="text/javascript"></script>
		<script src="plugins/bert/settings.js" type="text/javascript"></script>
	</body>
</html>