<?php
session_start();
if(!isset ($_SESSION['user_id'])){
    header("Location:../login.php?msg=Log in first");
    exit();
}else{
	include('../Server/connection.php');
	include('includes/session.php');
	$st = 'add';
	if($st == 'add'){
	echo "<div class='div-request div-hide'>add</div>";
	}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <?php
	include 'title.php';
	?>
	
	
	<link type = "image/png" rel="icon" href="images/brvision.png" />

    <!-- Bootstrap must-->
    <link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
	
    <!-- Font Awesome must-->
    <link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
	
	<!-- custom css -->
    <link rel="stylesheet" href="custom/css/custom.css">
	
    <!-- NProgress must-->
    <link href="../vendors/nprogress/nprogress.css" rel="stylesheet">
	
    <!-- Custom Theme Style must-->
    <link href="../build/css/custom.min.css" rel="stylesheet">
	
	<!-- must-->
	<script src="assests/jquery/jquery.min.js"></script>
	
  <!-- jquery ui -->  
  <link rel="stylesheet" href="assests/jquery-ui/jquery-ui.min.css">
  <script src="assests/jquery-ui/jquery-ui.min.js"></script>
	
  <!-- Must Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	
	
	
	
	
  </head>

  <body class="nav-md">
  
    <div class="container body">
	
      <div class="main_container">
        <div class="col-md-3 left_col">
          <div class="left_col scroll-view">
		  
            <?php  
		include 'includes/role.php';
               ?>

            <div class="clearfix"></div>
            
			<?php
            include 'includes/profile.php';
			print '</br></br>';
			include 'includes/menu.php';
			?>

           

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
		  
			
			
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
				  
                    <a href="dashboard.php">  <h2><span class="glyphicon glyphicon-step-backward"></span> Back</h2></a>
					
				
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                     
                    </ul>
                    <div class="clearfix"></div>
                  </div>
				  
				 
				  
                 <div class="x_content" style="overflow: auto;">
				 
				 <?php if (isset($_SESSION['success_message']) && !empty($_SESSION['success_message'])) { ?>
                        <div class="success-message" style="margin-bottom: 20px;font-size: 20px;color: green;"><?php echo $_SESSION['success_message']; ?></div>
                        <?php
                        unset($_SESSION['success_message']);
                    }
                    ?>	
				 
				  <div class="success-messages"></div> <!--/success-messages-->

               <form class="form-horizontal" method="POST" action="php_action/add_Trip.php">
			  
			  <div class="controls">
			  <div class="row">
			  

			  <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">Customer Name</label>
				  <select class="form-control" name="client_id" id="client_id" autocomplete="off" required />
				            <option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql = "SELECT * from clients";
			  							$productData = $conn->query($productSql);

			  							while($row = $productData->fetch_array()){									 		
			  								echo "<option value='".$row['client_id']."'>".$row['client_fname'].'&nbsp&nbsp'.$row['client_mname'].'&nbsp&nbsp'.$row['client_lname']."</option>";
										 	} // /while 

			  						?>
		  						</select>
                      
                    </div>
			  </div>
			  
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name">Payment Mode </label>
				  <select class="form-control" name="payment_mode_id" id="payment_mode_id" autocomplete="off" required />
				              <option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql3 = "SELECT * from payment_mode";
			  							$productData3 = $conn->query($productSql3);

			  							while($row3 = $productData3->fetch_array()){									 		
			  								echo "<option value='".$row3['payment_mode_id']."'>".$row3['name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
                      
                    </div>
			  </div>
			  
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name">Currency Type </label>
				  <select class="form-control" name="currency_id" id="currency_id" autocomplete="off" required />
				              <option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql39 = "SELECT * from currency";
			  							$productData39 = $conn->query($productSql39);

			  							while($row39 = $productData39->fetch_array()){									 		
			  								echo "<option value='".$row39['currency_id']."'>".$row39['currencyName']."</option>";
										 	} // /while 

			  						?>
		  						</select>
                      
                    </div>
			  </div>
			  
			
			  
			  	</div>	  
                </div>
				
				
				<div class="controls">
			  <div class="row">
			  

			  <div class="col-sm-4">
			  <div class="form-group">
                 <label for="form_name">Invoice Date </label>
                 <input  type="text" class="form-control" id="InvoiceDate" name="InvoiceDate"  placeholder="Invoice Date" autocomplete="off" required / >
                      
                    </div>
			  </div>
			  
			  <div class="col-sm-4">
			  <div class="form-group">
			  
			  <label for="form_name">Due Date </label>
                 <input  type="text" class="form-control" id="dueDate" name="dueDate"  placeholder="Due Date" autocomplete="off" required />
                 
                      
                    </div>
			  </div>
			  
			  <div class="col-sm-4">
			  <div class="form-group">
			  
			  <label for="form_name">Order No </label>
                 <input  type="text" class="form-control" id="orderNo" name="orderNo"  placeholder="Order No" autocomplete="off"/>
                 
                      
                    </div>
			  </div>
			 
			  
			  	</div>	  
                </div>
				
				
				
				

              <table class="table" id="productTable">
			  	<thead>
			  		<tr>			  			
			  			<th style="width:5%;">S/N</th>
						<th style="width:20%;">Items Description</th>
						<th style="width:20%;">Unit Of Measure</th>
			  			<th style="width:15%;">Quantity</th>
			  			<th style="width:15%;">Price</th>			  			
			  			<th style="width:20%;">Total</th>			  			
			  			<th style="width:5%;"></th>
			  		</tr>
			  	</thead>
			  	<tbody>
			  		<?php
			  		$arrayNumber = 0;
					$no 	= 1;
			  		for($x = 1; $x < 4; $x++) { ?>
			  			<tr id="row<?php echo $x; ?>" class="<?php echo $arrayNumber; ?>">	
						
						   <td style="padding-left:20px;">
			  					<div class="form-group">
								<?php
								print $x;
								?>
			  					</div>
			  				</td>
							
							
							

                            
							
							 <td style="padding-left:20px;">
			  					<div class="form-group">
								<textarea rows="3" cols="50" name="serv_desc[]" id="serv_desc<?php echo $x; ?>" class="form-control" style="margin-left:0%;" autocomplete="off" required /> </textarea>
								
			  					</div>
			  				</td>	
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								
								<select class="form-control" name="measure_id[]" id="measure_id<?php //echo $x; ?>" required />
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql331 = "SELECT * FROM unit_measure";
			  							$productData331 = $conn->query($productSql331);

			  							while($row331 = $productData331->fetch_array()){									 		
			  								echo "<option value='".$row331['measure_id']."'>".$row331['measure_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
								
								
			  					
								
								</div>
			  				</td>	
							
							
			  			
							
							
							<!--choosed -->
			  				<td style="padding-left:20px;">
			  					<div class="form-group">
			  					<input type="number" name="quantity[]" id="quantity<?php echo $x; ?>" onkeyup="getTotal(<?php echo $x ?>)" autocomplete="off" class="form-control" min="1" required />
			  					</div>
			  				</td>
							<!--choosed -->
							
							<td style="padding-left:20px;">			  					
			  					<input type="text" name="rate[]" id="rate<?php echo $x; ?>" onkeyup="getTotal(<?php echo $x ?>)" autocomplete="off"  class="form-control" required />			  					
			  					<input type="hidden" name="rateValue[]" id="rateValue<?php echo $x; ?>" autocomplete="off" class="form-control" />			  					
			  				</td>
							
							
			  				<td style="padding-left:20px;">			  					
			  					<input type="text" name="total[]" id="total<?php echo $x; ?>" autocomplete="off" class="form-control" disabled="true" required />			  					
			  					<input type="hidden" name="totalValue[]" id="totalValue<?php echo $x; ?>" autocomplete="off" class="form-control" />			  					
			  				</td>
							
							
			  				<td>

			  					<button class="btn btn-default removeProductRowBtn" type="button" id="removeProductRowBtn" onclick="removeProductRow(<?php echo $x; ?>)"><i class="glyphicon glyphicon-trash"></i></button>
			  				</td>
			  			</tr>
		  			<?php
		  			$arrayNumber++;
					$no++;
			  		} // /for
			  		?>
			  	</tbody>			  	
			  </table>
			  
			  <div class="col-md-6">
			  
			       <div class="form-group">
				    <div class="col-sm-6">
				      <button type="button" class="btn btn-default" onclick="addRow()" id="addRowBtn" data-loading-text="Loading..."> <i class="glyphicon glyphicon-plus-sign"></i> Add Row </button>
				    </div>
				  </div> <!--/form-group-->	
				  
				 </br>
				 
			  	<div class="form-group">
				    <label for="subTotal" class="col-sm-3 control-label">Sub Total</label>
				    <div class="col-sm-9">
				      <input type="text" class="form-control" id="subTotal" name="subTotal" disabled="true" />
				      <input type="hidden" class="form-control" id="subTotalValue" name="subTotalValue" />
				    </div>
				  </div> <!--/form-group-->	
				  
				    
	  		  
			  </div> <!--/col-md-6-->
			  
			  </br></br></br></br></br>
			  
			   <!--<div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-12">
			  <div class="form-group">
                 <label for="form_name">Message: </label>
                 
			
			<textarea id="message" rows="10" cols="50" name="message" class="form-control" style="margin-left:0%;" autocomplete="off" required /> </textarea>
			
                      
                </div>
			   </div>
			
				
			  </div>	  
              </div>-->
			
			  <div class="form-group submitButtonFooter">
			    <div class="col-sm-12">
			      <button type="submit" id="createOrderBtn" data-loading-text="Loading..." class="btn btn-success"><i class="glyphicon glyphicon-ok-sign"></i> Submit</button>
                  
			    </div>
			  </div>
			  
			  
			</form>                  
					
				</div>
				
				
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->
		
		
		<?php
		include 'includes/footer.php';
		?>
		
        
      </div>
    </div>
	
	<script>
	// order date picker
		$("#InvoiceDate").datepicker();
		
		// delivery date picker
		$("#dueDate").datepicker();
	
	</script>
	
	 <!-- Must -->
    <script src="custom/js/createStaff.js"></script>
    
	
    <!-- Must Custom Theme Scripts -->
    <script src="../build/js/custom.min.js"></script>
	
	<!-- file input -->
	<script src="assests/plugins/fileinput/js/plugins/canvas-to-blob.min.js'); ?>" type="text/javascript"></script>	
	<script src="assests/plugins/fileinput/js/plugins/sortable.min.js" type="text/javascript"></script>	
	<script src="assests/plugins/fileinput/js/plugins/purify.min.js" type="text/javascript"></script>
	<script src="assests/plugins/fileinput/js/fileinput.min.js"></script>	


	<!-- DataTables -->
	<script src="assests/plugins/datatables/jquery.dataTables.min.js"></script>

  </body>
</html>



<?php
}
?>