<?php include "layouts/menu.php"; ?>
		
		<script type="text/javascript">
	  $(function() {
   $("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' });
  });
</script>
<script type="text/javascript">
function zp(n){
return n<10?("0"+n):n;
}
function insertDate(t,format){
var now=new Date();
var DD=zp(now.getDate());
var MM=zp(now.getMonth()+1);
var YYYY=now.getFullYear();
format=format.replace(/DD/,DD);
format=format.replace(/MM/,MM);
format=format.replace(/YYYY/,YYYY);
t.value=format;
}
</script>
    <script>
  $(function() {
   $("#datepicker1").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
    <script>
  $(function() {
   $("#datepicker2").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
      <script>
  $(function() {
   $("#datepicker8").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
    <script>
  $(function() {
   $("#datepicker9").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
     
   <?php include "layouts/menu1.php"; ?>
            <!-- Right side column. Contains the navbar and content of the page -->
           <div class="right_col" role="main">
                <!-- Content Header (Page header) -->
            
				 <div class="panel-body">
                            <div class="row">
 <div class="col-lg-12">  
								 </br>
				    
                                   <?php	$qry=mysqli_query($conn, "select * from customer order by code DESC");
						$n=mysqli_num_rows($qry);
						if($n==0)
						{
							$rty = 1;
						}
						else
					    {
						$row=mysqli_fetch_array($qry);
						
						$sss = $row['code'];
						
						$rtyy = $sss + 1;
						$rty = $rtyy;
						} ?>
									  <div class="alert alert-info">New Registration For Staff</div>
                           <div class="col-lg-6">
   <form role="form" name="form1" method="post" action="newemp.php" enctype="multipart/form-data">
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Name of the Staff</label>
      <input type="text" class="form-control" id="inputPassword3" name="name" required>
 </div>
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Staff code</label>
      <input type="text" class="form-control" value="<?php echo $rty; ?>" id="inputPassword3" name="code" required>
 </div>
  <div class="form-group has-success has-feedback">
    <label for="inputEmail3" >Father/Spouse Name</label>
      <input type="text" class="form-control" id="inputEmail3" name="fname" value="">
  </div>
  <div class="form-group has-success has-feedback">
    <label for="inputEmail3" >Upload Image</label>
    <input type="file" id="exampleInputFile" name="uimg" >
    <p class="help-block">Upload Passport size Photo here.</p>
  </div>  
  
    <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Previous year of Experience</label>
      <input type="text" class="form-control" id="inputPassword3" name="exp" value="1">
	 <input type="text" class="form-control" id="inputPassword3" name="expr" value="2">
 
  </div>
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Education Qualification</label>
      <input type="text" class="form-control" id="inputPassword3" name="edu" value="">
  </div>
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Total year/month of Experience</label>
      <input type="text" class="form-control" id="inputPassword3" name="year" value="">
    <span class="glyphicon glyphicon-tint form-control-feedback"></span>
  </div>
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3">Co-curricular Activities</label>
      <input type="text" class="form-control" id="1" name="act"  value="">
  </div>
   </div> <div class="col-lg-6">
  
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3">Joining Date</label>
      <input type="date" class="form-control" id="datepicker" name="yearr" value="">
    </div> 
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3">Mobile No</label>
      <input type="text" class="form-control" id="datepicker" name="mno" value="">
    </div>
 <div class="form-group has-success has-feedback">
    <label for="inputPassword3">Address</label>
      <textarea cols="3" rows="3" type="text" class="form-control" id="datepicker" name="id" value=""></textarea>
    </div> 
  
     <div class="form-group has-success has-feedback">
    <label for="inputPassword3">E-Mail/Username</label>
      <input type="text" class="form-control" id="datepicker" name="mail" value="">
    </div>
	    <div class="form-group has-success has-feedback">
    <label for="inputPassword3">Password</label>
      <input type="password" class="form-control"  name="pwd" value="">
    </div>
	
	
     <div class="form-group has-success has-feedback">
    <label for="inputPassword3">User Privilege</label>
      <select type="text" class="form-control" id="datepicker" name="desig" value="">
  		 <?php if($postt == 'MD')   { ?>     <option value="MD">Superadmin</option> <?php } ?>
      <option>Office All</option>
	  <option>Office POSTING</option>
	  <option>Office</option>
      <option>Collection</option>
      <option>Other</option></select>
    </div> 
	  <div class="form-group has-success has-feedback">
    <label for="inputPassword3">Allowed Companies</label>
      <select type="text" class="form-control" id="datepicker" name="inter" value="">
      <option>All Company</option> <?php $sql88 = mysqli_query($conn, "select * from mfin");
	  while($row88 = mysqli_fetch_array($sql88)) { ?>
	  <option><?php echo $row88['name']; ?></option>
	  <?php } ?> </select>
    </div> 
	   <div class="form-group has-success has-feedback">
    <label for="inputPassword3">Login Time From</label>
      <input type="time" class="form-control" id="datepicker" name="timef" value="">
    </div>
	   <div class="form-group has-success has-feedback">
    <label for="inputPassword3">Login Time To</label>
      <input type="time" class="form-control" id="datepicker" name="timet" value="">
    </div>
	</div>
   
 <div class="form-group">
  
      <button type="submit" class="btn btn-primary btn-lg btn-block" name="s5">Register</button>

  </div>   <div>
	 
<?php
							if(isset($_POST['s5']))
							{
								extract($_POST);
								$uimg=$_FILES['uimg']['name'];
								
								$insert=mysqli_query($conn, "INSERT INTO `customer`(`timef`, `timet`, `name`, `code`, `fname`, `uimg`, `edu`, `exp`, 
								`expr`, `year`, `act`, `inter`, `id`, `desig`,`mail`,`mno`,`pwd`) VALUES ('$timef', '$timet', '$name', '$code','$fname', '$uimg', '$edu', '$exp','$expr', '$year','$act','$inter','$id','$desig','$mail','$mno','$pwd')");
								if($insert)
								{
								$move=move_uploaded_file($_FILES['uimg']['tmp_name'],"user/".$uimg);	
								echo "Sucessful";	
								}
								else
								{
									echo "Failure";
								}
							}
?>	 
	  </div>
</form>
</div></div></div>
  
  		<div class="alert alert-info">Staff Details</div>
  
                    <?php
					
						$qry=mysqli_query($conn, "select * from customer");
						$n=mysqli_num_rows($qry);
						if($n==0)
						{
							echo "Nothing To Display";
						}
						else
					{ 
						?></p>
						<div class="table-responsive">
  <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered">            
					<thead>
  <tr>
						<th>Staff Code</th>
						<th>Name</th>
						
						<th>Username</th>
						<th>Phone</th>
						<th>Desig</th>
						<th>User Image</th>									<?php	if($postt == 'MD') { ?> <th>Cancel</th>  <?php } ?>
						<th>Educational Qualification</th>
						<th>Experience</th>
						<th>More Details</th>
					</tr></thead><tbody>
					<?php 
					while($row=mysqli_fetch_array($qry))
						{
					?>
					<tr>
		
						<td><?php echo $row['code'];?></td>
						<td><?php echo $row['name'];?></td>
						<td><?php echo $row['mail'];?></td>
						<td><?php echo $row['pno'];?></td>
						<td><?php echo $row['desig'];?></td>
						<td><img src="user/<?php echo $row['uimg'];?>" width="50" height="50"/></td>
														<?php	if($postt == 'MD') { ?>	<td><b>
<a href="edituser.php?cod=<?php echo $row['code'];?>" class="btn btn-info btn-xs" onclick="return confirm('Are you sure WANT TO Edit?');">Edit</a>	
</br><a href="canceluser.php?cod=<?php echo $row['code'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></b></td>  <?php } ?>
						<td><?php echo $row['edu'];?></td>
						<td><?php echo $row['year'];?></td>
						<td><a href="m.udelete.php?hpl=<?php echo $row['name'];?>&name=<?php echo $row['name'];?>">More Info</a></td>
					</tr>
					<?php
						}
					}
				
					?> </tbody>
					    </table>
                      
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              
        <!-- /page content -->

        <!-- footer content --> 
        <footer>
          <div class="pull-right">
             <a href="https://infossel.com">Infossel Soft Solution</a>
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>

    <!-- jQuery -->
    <script src="vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="vendors/nprogress/nprogress.js"></script>
    <!-- iCheck -->
    <script src="vendors/iCheck/icheck.min.js"></script>
    <!-- Datatables -->
    <script src="vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
    <script src="vendors/jszip/dist/jszip.min.js"></script>
    <script src="vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="vendors/pdfmake/build/vfs_fonts.js"></script>

    <!-- Custom Theme Scripts -->
    <script src="build/js/custom.min.js"></script>

  </body>
</html>