<?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/kreen.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>
	
	<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/additional-methods.min.js"></script>
	
  <!-- jquery ui must-->  
  <link rel="stylesheet" href="assests/jquery-ui/jquery-ui.min.css">
  <script src="assests/jquery-ui/jquery-ui.min.js"></script>
	
  <!-- Must Bootstrap must-->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	
	<style>
  .error {
    color: #F00;
}  

</style>
	
	<script type="text/javascript">
$(document).ready(function(){
    $('#entryId').on('change',function(){
        var regID = $(this).val();
        if(regID){
            $.ajax({
                type:'POST',
                url:'ajaxData2.php',
                data:'entryId='+regID,
                success:function(html){
                    $('#entryNameId').html(html);
                }
            }); 
        }else{
            $('#entryNameId').html('<option value="">Select EntryPoint Type First</option>');
        }
    });

});
</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>
					</br></br>
					<font color="green">OPEN CLIENT FILE</font>
					
					
                    <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" id="id_frm" method="POST" enctype="multipart/form-data" action="php_action/file.php">
			   
			   <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">Client Name </label>
                 <select class="form-control" name="client_id" id="client_id" autocomplete="off">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql = "SELECT * FROM clients ORDER BY client_fname";
			  							$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>
								
								<br/>
                         <label for="client_id" class="error" generated="true"></label>
                      
                </div>
			   </div>
			   
			   <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name">Entry Point Type </label>
                 <select class="form-control" name="entryId" id="entryId" autocomplete="off">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql2 = "SELECT * FROM entrypoint_type ORDER BY name";
			  							$productData2 = $conn->query($productSql2);
			  							while($row2 = $productData2->fetch_array()){									 		
			  								echo "<option value='".$row2['entryId']."'>".$row2['name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
								
								<br/>
                         <label for="entryId" class="error" generated="true"></label>
                      
                </div>
			   </div>
			   
			   <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name">Entry Point Name </label>
                 <select class="form-control" name="entryNameId" id="entryNameId" autocomplete="off">
			  						<option value="">~~SELECT~~</option>
			  						
		  						</select>
                      
                </div>
			   </div>
			 
			  
			  	</div>	  
                </div>
				
				
			  <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">B/L NO: </label>
                 
			<input type="text" class="form-control" id="b_lNo" name="b_lNo" placeholder="B/L NO" autocomplete="off" />
			
			<br/>
                         <label for="b_lNo" class="error" generated="true"></label>
                      
                </div>
			   </div>
			   
			   
			    <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">TRA Ref.Number: </label>
                
				<input type="text" class="form-control" id="tra_RefNo" name="tra_RefNo" placeholder="TRA Ref.Number" autocomplete="off"/>
                      
                </div>
			   </div>
				
				
			  </div>	  
              </div>
			  
			  
			  <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">CONSIGNEE: </label>
                 
			<input type="text" class="form-control" id="consignee" name="consignee" placeholder="CONSIGNEE" autocomplete="off"/>
			
			<br/>
                         <label for="consignee" class="error" generated="true"></label>
                      
                </div>
			   </div>
			   
			   
			    <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">GOODS: </label>
                
				<input type="text" class="form-control" id="goods" name="goods" placeholder="GOODS" autocomplete="off"/>
				
				<br/>
                         <label for="goods" class="error" generated="true"></label>
                      
                </div>
			   </div>
				
				
			  </div>	  
              </div>
			  
			  
			  <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">VESSEL/FLIGHT/TRUCK: </label>
                 
			<input type="text" class="form-control" id="vesselFlight" name="vesselFlight" placeholder="VESSEL/FLIGHT/TRUCK" autocomplete="off"/>
			
			<br/>
                         <label for="vesselFlight" class="error" generated="true"></label>
                      
                </div>
			   </div>
			   
			   
			    <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">Shipping Line/Transporter/Airline: </label>
                
				<input type="text" class="form-control" id="sline" name="sline" placeholder="Shipping Line/Transporter/Airline" autocomplete="off" />
                 
                <br/>
                         <label for="sline" class="error" generated="true"></label>

				 
                </div>
			   </div>
				
				
			  </div>	  
              </div>
				
		   <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">Estimated Time Arrival - E.T.A: </label>
                 
			<input type="text" class="form-control" id="eta" name="eta" placeholder="E.T.A" autocomplete="off"/>
			
			<br/>
                         <label for="eta" class="error" generated="true"></label>
                      
                </div>
			   </div>
			   
			   
			    <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">DESTINATION: </label>
                
				<input type="text" class="form-control" id="destination" name="destination" placeholder="DESTINATION" autocomplete="off"/>
				
				<br/>
                         <label for="destination" class="error" generated="true"></label>
                      
                </div>
			   </div>
				
				
			  </div>	  
              </div>
			  
			 
			  
			  <div class="controls">
			  <div class="row">
			   
			    <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">Add Expenses: </label>
				 </br>
				 <label class="radio-inline">
          <input type="radio" name="exp_status" value="YES" id="exp_status"> Yes
         </label>&nbsp&nbsp&nbsp&nbsp
         <label class="radio-inline">
          <input type="radio" name="exp_status" value="NO" id="exp_status" checked> No
         </label>&nbsp&nbsp&nbsp&nbsp
                
				
                      
                </div>
			   </div>
				
				
			  </div>	  
              </div>
				
			<div id="textboxes33" style="display: none">	
             
			  <table class="table" id="productTable">
			  	<thead>
			  		<tr>	
                        <th style="width:5%;">S/NO.</th>		  			
			  			<th style="width:20%;">Standard Expenses</th>
			  			<th style="width:15%;">Amount</th>
			  			<th style="width:15%;">Paid</th>			  			
			  			<th style="width:25%;">Invoice No</th>			  			
			  			<th style="width:15%;">Currency</th>
						<th style="width:5%;"></th>
			  		</tr>
			  	</thead>
			  	<tbody>
			  		<?php
			  		$arrayNumber = 0;
					$no 	= 1;
			  		for($x = 1; $x < 2; $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="margin-left:20px;">
			  					<div class="form-group">

			  					<select class="form-control" name="standardexp_id[]" id="standardexp_id<?php echo $x; ?>" >
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql6 = "SELECT * FROM standard_expenses";
			  							$productData6 = $conn->query($productSql6);

			  							while($row6 = $productData6->fetch_array()) {									 		
			  								echo "<option value='".$row6['standardexp_id']."'>".$row6['name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
								
								<!--<br/>
                         <label for="standardexp_id" class="error" generated="true"></label>-->
								
								
			  					</div>
			  				</td>

                            <td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="number" name="amount[]" class="form-control" id="amount<?php echo $x; ?>" min="1"  placeholder="Amount" autocomplete="off"/>
			  					</div>
			  				</td>	
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								
								<select class="form-control" name="chargeable_to[]" id="chargeable_to<?php echo $x; ?>" >
			  						<option value="">~~SELECT~~</option>
			  						<option>YES</option>
									<option>NO</option>
		  						</select>
								
								
			  					</div>
			  				</td>
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="invoice[]" class="form-control" id="invoice<?php echo $x; ?>"   placeholder="Invoice No" autocomplete="off" />
			  					</div>
			  				</td>
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								
								<select class="form-control" name="debitNote[]" id="debitNote<?php echo $x; ?>" >
			  						<option value="">~~SELECT~~</option>
			  						<option>TSH</option>
									<option>USD</option>
		  						</select>
								
								
								<!--<input type="text" name="debitNote[]" class="form-control" id="debitNote<?php echo $x; ?>"   placeholder="Debit Note" autocomplete="off"  />-->
			  					</div>
			  				</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++;
			  		} // /for
			  		?>
			  	</tbody>			  	
			  </table>
			  
			  <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>
			  </br></br>
			  
			  </div>	
			  
	         <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-4">
			  <div class="form-group">
			  
			  <label for="form_name">Upload Document (s): </label>
				 </br>
				 <label class="radio-inline">
          <input type="radio" name="upl_status" value="Yes" id="upl_status"> Yes
         </label>&nbsp&nbsp&nbsp&nbsp
         <label class="radio-inline">
          <input type="radio" name="upl_status" value="No" id="upl_status" checked> No
         </label>&nbsp&nbsp&nbsp&nbsp
		 
		
		
		<div id="textboxes3" style="display: none">		
		     
			 <label for="form_name">Upload Document(s) </label>
			  <input  type="file" name="file[]"  id="file" class="form-control" style="width:100%;margin-left:0%;" multiple>
			  
			   <br/>
        <label for="file" class="error" generated="true"></label>
			 
			</div>
              
				  
                </div>
			   </div>
			   
			   <div class="col-sm-2">
			  <div class="form-group">
                 
			
                      
                </div>
			   </div>
			   
			   
			    <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">Close File: </label>
				 </br>
				 <label class="radio-inline">
          <input type="radio" name="file_status" value="Yes" id="file_status"> Yes
         </label>&nbsp&nbsp&nbsp&nbsp
         <label class="radio-inline">
          <input type="radio" name="file_status" value="No" id="file_status" checked> No
         </label>&nbsp&nbsp&nbsp&nbsp
                
				
                      
                </div>
			   </div>
				
				
			  </div>	  
              </div>
			  
			  
			  
			   <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-12">
			  <div class="form-group">
                 <label for="form_name">Email Message: </label>
                 
			
			<textarea id="message" rows="10" cols="50" name="message" class="form-control" style="margin-left:0%;" autocomplete="off"> </textarea>
			<br/>
                         <label for="message" class="error" generated="true"></label>
			
                      
                </div>
			   </div>
			
				
			  </div>	  
              </div>
			  
			 
			  <div class="form-group submitButtonFooter">
			    <div class="col-sm-offset-0 col-sm-12">
			    

			    <button type="submit" id="createOrderBtn" data-loading-text="Loading..." class="btn btn-success"><i class="glyphicon glyphicon-ok-sign"></i> Submit & Send </button>

			      
			    </div>
			  </div>
			 
			</form>                    
					
				</div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->
		
		
		<?php
		include 'includes/footer.php';
		?>
		
        
      </div>
    </div>
	
				<script>
//$(function(){
$(document).ready(function(){
    $('input[name="exp_status"]').on('click', function(){
        if ($(this).val() == 'YES'){
			 $('#textboxes33').show();
        }else {
			$('#textboxes33').hide();
		}
	
		
    });
});


$(document).ready(function(){
    $('input[name="upl_status"]').on('click', function(){
        if ($(this).val() == 'Yes'){
			 $('#textboxes3').show();
        }else {
			$('#textboxes3').hide();
		}
	
		
    });
});


 $("#id_frm").validate({
        rules: {
			
			"client_id": {
                required: true
            },
			
			"entryId": {
                required: true
            },
			
			"b_lNo": {
                required: true
            },
			
			"consignee": {
                required: true
            },
			
			"goods": {
                required: true
            },
			
			
			"vesselFlight": {
                required: true
            },
			
			
			"sline": {
                required: true
            },
			
			"file": {
                required: true
            },
			
			
            "eta": {
                required: true,
                //minlength: 10,
                // minlength: 10 // same rule twice
            },
			
			"message": {
                required: true
            },
			
			"destination": {
                required: true
            }
			
			
            
        },
        messages: {
			
			"client_id": {
                required: "Please Select Client."
            },
			
			"entryId": {
                required: "Please Select Entry Point Type"
            },
			
			"b_lNo": {
                required: "Please Enter B/L NO"
            },
			
            "consignee": {
                required: "Please Enter CONSIGNEE"
            },
			
			"goods": {
                required: "Please Enter Goods"
            },
			
			"vesselFlight": {
                required: "Please Enter Vessel/Flight/Truck."
            },
			
			"sline": {
                required: "Please Enter Shipping Line/Transporter/Airline"
            },
			
			"file": {
                required: "Please Upload at least one document."
            },
			
			
			"eta": {
                required: "Please Enter Estimated Time Arrival - E.T.A"
            },
			
			"message": {
                required: "Please Compose Message."
            },
			
			
			"destination": {
                required: "Please Enter Destination"
            }
			
			
			
        },
        // for demo
        //submitHandler: function(form) {
            //alert('valid form');
            //return false;
        //}
 });


</script>
	
	<script>
	// order date picker
		$("#eta").datepicker();
		
		// delivery date picker
		//$("#dueDate").datepicker();
	
	</script>

    
     <!-- Must -->
    <script src="custom/js/file.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
}
?>