<?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');
?>


<!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 -->
    <link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="../vendors/nprogress/nprogress.css" rel="stylesheet">
	
	 <!-- bootstrap-daterangepicker -->
    <link href="../vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
    <!-- bootstrap-datetimepicker -->
    <link href="../vendors/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css" rel="stylesheet">
	
	<!-- bootstrap-datetimepicker -->
    <link href="../vendors/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css" rel="stylesheet">
    
    <!-- Custom Theme Style -->
    <link href="../build/css/custom.min.css" rel="stylesheet">
	
	<!-- jQuery -->
    <script src="../vendors/jquery/dist/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>
	
   <script type="text/javascript">
$(document).ready(function(){
    $('#client_id').on('change',function(){
        var regID = $(this).val();
        if(regID){
            $.ajax({
                type:'POST',
                url:'ajaxData12.php',
                data:'client_id='+regID,
                success:function(html){
                    $('#file_id').html(html);
                }
            }); 
        }else{
            $('#file_id').html('<option value="">Select Client First</option>');
        }
    });

});
</script>
	
	<style>
  .error {
    color: #F00;
}  

</style>
	
  </head>

  <body class="nav-md">
  
    <div class="container body">
	
    <?php
	//include 'header.php';
	?>
	
      <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']);
                    }
                    ?>	

                    <form action="php_action/uploadDocument.php"  id="id_frm" method="post" enctype="multipart/form-data" class="form-horizontal form-label-left">

                      
					  
                      <span class="section">Send email with attachment</span>
					  
					  
					 
					 <div class="item form-group">
                        <label for="password" class="control-label col-md-3">Customer</label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
						
						  <select class="form-control" name="client_id" id="client_id" autocomplete="off">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql = "SELECT clients.client_id,clients.client_fname,clients.client_lname 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_lname']."</option>";
										 	} // /while 

			  						?>
		  						</select>
								<br/>
                         <label for="client_id" class="error" generated="true"></label>
                         
                        </div>
                      </div>
					  
					  
					  <div class="item form-group">
                        <label for="password" class="control-label col-md-3">File No</label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          
                        <select class="form-control" name="file_id" id="file_id" autocomplete="off">
			  						<option value="">~~SELECT~~</option>
		  						</select>
						  
						</div>
                      </div>
					  
					  <div class="item form-group">
                        <label for="password" class="control-label col-md-3">Upload Document-s</label>
					  	
                        <div class="col-md-6 col-sm-6 col-xs-12">
						
						<input  type="file" name="file[]"  id="file" class="form-control" style="width:100%;margin-left:0%;" multiple>
						
						</div>
						</div>
					 
					 <div class="item form-group">
                        <label for="password" class="control-label col-md-3">Email Message</label>
					  	
                        <div class="col-md-6 col-sm-6 col-xs-12">
						
						<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 class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
						  <button class="btn btn-success"><span class="glyphicon glyphicon-registration-save"> </span> Send </button>
                        </div>
                      </div>
                    </form>
					
			
					
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->

		<?php
		include 'includes/footer.php';
		?>
		
        
      </div>
    </div>
	
	
	<script>
	$(document).ready(function(){
    $('input[name="payment_mode_id"]').on('click', function(){
        if ($(this).val() == 1){
			 $('#textboxes3').show();
			 $('#textboxes4').hide();
			 $('#textboxes5').hide();
        }else if($(this).val() == 2){
			$('#textboxes4').show();
			$('#textboxes3').hide();
			$('#textboxes5').hide();
		}else if($(this).val() == 5){
			$('#textboxes5').show();
			$('#textboxes3').hide();
			$('#textboxes4').hide();
		}
	
		
    });
});


 $("#id_frm").validate({
        rules: {
			
			"client_id": {
                required: true
            },
			
			"currency_id": {
                required: true
            },
			
			"currency_id1": {
                required: true
            },
			
			"currency_id2": {
                required: true
            },
			
			"amount": {
                required: true
            },
			
			"amount1": {
                required: true
            },
			
			"amount2": {
                required: true
            },
			
			"cheque_no": {
                required: true
            },
			
			"bank_slip_no": {
                required: true
            },
			
			"message": {
                required: true
            },
			
			"payment_mode_id": {
                required: true
            }
		 
        },
        messages: {
			
			"client_id": {
                required: "Please Select Client."
            },
			
			"currency_id": {
                required: "Please Select Bank Account."
            },
			
			"currency_id1": {
                required: "Please Select Bank Account."
            },
			
			"currency_id2": {
                required: "Please Select Bank Account."
            },
			
			"amount": {
                required: "Please Enter Amount Paid"
            },
			
			"amount1": {
                required: "Please Enter Amount Paid"
            },
			
			"amount2": {
                required: "Please Enter Amount Paid"
            },
			
			"cheque_no": {
                required: "Please Enter Cheque Number"
            },
			
			"bank_slip_no": {
                required: "Please Enter Bank Slip Number"
            },
			
			"message": {
                required: "Please Enter Email message"
            },
			
			"payment_mode_id": {
                required: "Please Select Payment Mode"
            }
			
			
			
        },
        // for demo
        //submitHandler: function(form) {
            //alert('valid form');
            //return false;
        //}
 });
</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>
	
    <!-- validator -->
    <!--<script src="../vendors/validator/validator.js"></script>-->
	
	<!-- bootstrap-daterangepicker -->
    <script src="../vendors/moment/min/moment.min.js"></script>
	
	<!-- bootstrap-datetimepicker -->    
    <script src="../vendors/bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>

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



<?php
}
?>