<?php
ini_set('display_errors', 0);
//error_reporting(E_ALL);
//ini_set('display_errors', 1);

session_start();
ob_start();

require_once('configuration/server_connect.php');
require_once('configuration/all_function.php');

$active_id=$_REQUEST['active_id'];
$menu_id=$_REQUEST['menu_id'];

// Common Information

$page_title="User Register";
$page="81_user_02.php?active_id=".$active_id."&menu_id=".$menu_id."";
$table='user_management';	
$unique='user_id';

// End Common Information

?>

<!DOCTYPE html>
<html lang="en">

<?php require_once('inc_files/inc_head.php'); ?>

<body>

  <!-- ======= Header ======= -->
  <?php 
  require_once('inc_files/inc_header.php');
  ?><!-- End Header -->

  <!-- ======= Sidebar ======= -->
    <?php  require_once('inc_files/inc_menu.php'); ?>
	<!-- End Sidebar-->

  <main id="main" class="main">

    <div class="pagetitle">
      <h1><?php echo $page_title?></h1>
      <nav>
        <ol class="breadcrumb">
          <li class="breadcrumb-item"><a href="home.php">Home</a></li>
          <li class="breadcrumb-item">Admin Panel</li>
          <li class="breadcrumb-item active"><?php echo $page_title?></li>
        </ol>
      </nav>
    </div><!-- End Page Title -->

    <section class="section">
      <div class="row">
        <div class="col-lg-12"> 

          <div class="card">
            <div class="card-body">
			<br>
            <form class="row g-3" action="" method="post" name="codz" id="codz">
   		       
			
	<table width="80%" border="0" align="center">
      
      
      <tr height="50">
        <td width="28%" align="right">USER NAME:&nbsp;&nbsp;</td>
        <td colspan="3">
		 <?php
			 auto_complete_from_db_sql($conn,'SELECT concat(user_id," :: ",fname), concat(user_id," :: ",fname) FROM user_management
			WHERE 1 order by user_id','user_name');
		?>
                  <input type="text" class="form-control" id="user_name" name="user_name" value="<?php echo $_REQUEST['user_name']?>" >		</td>
        <td width="16%" rowspan="5" align="center" ><strong>
          &nbsp;&nbsp;&nbsp;
          <button type="submit" class="btn btn-success rounded-pill btn-sm">&nbsp;<i class="bi bi-filter me-1"></i> Run Report&nbsp;&nbsp;</button>
        </strong></td>
        <td width="17%" rowspan="5" align="center" ><a href="81_user_02.php?active_id=801&menu_id=1"><button type="button" class="btn btn-primary btn-sm"><i class="bi bi-plus-lg me-1"></i> Add an User&nbsp;&nbsp;&nbsp;</button></a></td>
      </tr>
    </table>
               
  </form>
	
              <!-- Table with stripped rows -->
              <table width="582" class="table datatable" style="font-size:12px;">
                <thead>
                  <tr>
                    <th width="75" scope="col"><span class="card-title" style="font-size:14px; text-transform:uppercase;">User ID </span></th>
                    <th width="86" scope="col"><span class="card-title" style="font-size:14px; text-transform:uppercase;">User NAME</span></th>
                    <th width="86" scope="col"><span class="card-title" style="font-size:14px; text-transform:uppercase;"> Name </span></th>
                    <th width="79" scope="col"><span class="card-title" style="font-size:14px; text-transform:uppercase;">Designation</span></th>
                    <th width="79" scope="col"><span class="card-title" style="font-size:14px; text-transform:uppercase;">Mobile No</span></th>
                    <th width="45" scope="col"><span class="card-title" style="font-size:14px; text-transform:uppercase;">Email</span></th>
                    <th width="86" scope="col"><span class="card-title" style="font-size:14px; text-transform:uppercase;"> Status</span></th>
                  </tr>
                </thead>
                <tbody>
					<?php
					
					
 $user_name = $_REQUEST['user_name'];
  $user=explode(' :: ',$user_name);
   $user_code=$user[0];
  
if($user_code!=''){
$user_con=" and user_id='".$user_code."' ";
}

	
		
					
					    $sql = 'select * from '.$table.' where 1 '.$user_con.' ';
						$query = mysqli_query($conn,$sql);
						while ($data = mysqli_fetch_object($query)) {

					?>
				
      <tr>
      <td><a href="<?php echo $page;?>&<?php echo $unique;?>=<?php echo $data->user_id;?>" style="color:#000000"><?php echo $data->user_id;?></a></td>
      <td><a href="<?php echo $page;?>&<?php echo $unique;?>=<?php echo $data->user_id;?>" style="color:#000000"><?php echo $data->username;?></a></td>
      <td><a href="<?php echo $page;?>&<?php echo $unique;?>=<?php echo $data->user_id;?>" style="color:#000000"><?php echo $data->fname;?></a></td>
      <td><a href="<?php echo $page;?>&<?php echo $unique;?>=<?php echo $data->user_id;?>" style="color:#000000"><?php echo $data->designation;?></a></td>
      <td><a href="<?php echo $page;?>&<?php echo $unique;?>=<?php echo $data->user_id;?>" style="color:#000000"><?php echo $data->mobile_no;?></a></td>
      <td><a href="<?php echo $page;?>&<?php echo $unique;?>=<?php echo $data->user_id;?>" style="color:#000000"><?php echo $data->email;?></a></td>
      <td><a href="<?php echo $page;?>&<?php echo $unique;?>=<?php echo $data->user_id;?>" style="color:#000000"><?php echo $data->status;?></a></td>
      </tr>
				  <?php }?>
                </tbody>
              </table>
              <!-- End Table with stripped rows -->

            </div>
          </div>

        </div>

        
      </div>
    </section>

  </main><!-- End #main -->

  <!-- ======= Footer ======= -->
  <?php require_once('inc_files/inc_footer.php'); ?>

</body>

</html>