<?php
$msg='';
include("include/settings.php");
//include("checksession.php");

$usermaster=$mysqli->prepare("select * from cdi_usermaster where user_type='sales_exec' order by user_creationdate desc");
$usermaster->execute();
$userresult=$usermaster->get_result();

?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Manage Users - Rishta Depot </title>
  
		
<?php include('./include/meta.php'); ?>

</head>
	
<?php include('./include/header.php'); ?>
  
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
	  <div class="container-full">
		<!-- Content Header (Page header) -->
		<div class="content-header">
			<div class="d-flex align-items-center">
				<div class="me-auto">
					<h4 class="page-title">Users</h4>
							<center><p class="errormessage" id="errormessage"><?php echo $msg ?></p></center>
					<div class="d-inline-block align-items-center">
						<nav>
							<ol class="breadcrumb">
								<li class="breadcrumb-item"><a href="#"><i class="mdi mdi-home-outline"></i></a></li>
								<li class="breadcrumb-item" aria-current="page">Manage Users</li>
								<li class="breadcrumb-item active" aria-current="page">Users</li>
							</ol>
						</nav>
					</div>
				</div>
				
			</div>
		</div>

		<!-- Main content -->
		<section class="content">
		  <div class="row">
			<div class="col-12">

			 <div class="box">
				<div class="box-header with-border">
				  <h3 class="box-title">Manage Users</h3>
				</div>
				<!-- /.box-header -->
				<div class="box-body">
					<div class="table-responsive">
						<?php
										if(mysqli_num_rows($userresult)>0)
										{
											?>
					  <table id="example1" class="table table-bordered table-striped">
						<thead>
							<tr>
								<th>Sr.No</th>
								<th>ID</th>
								<th>User Name</th>
								<th>Email Id</th>
								<th>Status</th>
								<th>Edit</th>
							</tr>
						</thead>
						<tbody>
						         <?php
													$i=0;
													while($userrow=mysqli_fetch_object($userresult))
													{
														$i++;
														?>
															<tr class="text-center">
																<td><?php echo $i; ?></td>
																<td><?php echo $userrow->user_id ?></td>
																<td class="text-left"><?php echo $userrow->user_full_name ?></td>
																<td><?php echo $userrow->user_email_id ?></td>
																<td><?php echo $userrow->user_status==1?'Active':'Inactive' ?></td>
																<td><a href="edituser.php?userid=<?php echo $userrow->user_id ?>">View/Edit</a></td>
															</tr>
														<?php
													}
													?>
						</tbody>
					  </table>
					  	<?php
										}
									?>
					</div>
				</div>
				<!-- /.box-body -->
			  </div>
			  <!-- /.box -->


			  <!-- /.box -->          
			</div>
			<!-- /.col -->
		  </div>
		  <!-- /.row -->
		</section>
		<!-- /.content -->
	  
	  </div>
  </div>
  <!-- /.content-wrapper -->
  	<script>
		function getUsers(v)
		{
			$('#loading').css('display','');
			$.ajax({
					url: 'ajaxgetusers.php', 
					type: 'post',
					data:  {"usertype":v},
					datatype: 'html',
					success: function(rsp)
					{
						$('#ajaxcoursedata').html(rsp);
						$('#loading').css('display','none');
					}
				});
		}
	</script>
	
<?php include('./include/footer.php'); ?>
