  <?php 
session_start();
if (isset($_POST['acc_name'])) { 
    $_SESSION['acc_name'] = $_POST['acc_name'];
}

if (isset($_POST['amount'])) { 
    $_SESSION['amount'] = $_POST['amount'];
}
if (isset($_POST['racc_no'])) { 
    $_SESSION['racc_no'] = $_POST['racc_no'];
}
 
if (isset($_POST['bank_name'])) { 
    $_SESSION['bank_name'] = $_POST['bank_name'];
}
if (isset($_POST['type'])) { 
    $_SESSION['type'] = $_POST['type'];
}
if (isset($_POST['swift'])) { 
    $_SESSION['swift'] = $_POST['swift'];
}
if (isset($_POST['remarks'])) { 
    $_SESSION['remarks'] = $_POST['remarks'];
}
 
?> 
<?php include 'auth_header.php'; ?>

<div class="main-panel">        
        <div class="content-wrapper">
            
            
            
            
            
                      
                  <?php 
							if(isset($_GET['error']))
								{
									?>
									<div class='alert'>
										<button class='close' data-dismiss='alert'>&times;</button>
										<strong>Unable to Authenticate. Transfer Failed.</strong> 
									</div>
									<?php
								}
						?>
						<?php 
							if(isset($_GET['errorcot']))
								{
									?>
									<div class='alert'>
										<button class='close' data-dismiss='alert'>&times;</button>
										<strong>Invalid COT Code! Transfer Failed.</strong> 
									</div>
									<?php
								}
						?>
						<?php 
							if(isset($_GET['errortax']))
								{
									?>
									<div class='alert'>
										<button class='close' data-dismiss='alert'>&times;</button>
										<strong>Invalid Tax Code! Transfer Failed.</strong> 
									</div>
									<?php
								}
						?>
						<?php 
							if(isset($_GET['errorotp']))
								{
									?>
									<div class='alert'>
										<button class='close' data-dismiss='alert'>&times;</button>
										<strong>Invalid TRANSFER OTP Code! Transfer Failed.</strong> 
									</div>
									<?php
								}
						?>
						<?php 
							if(isset($_GET['insufficient']))
								{
									?>
									<div class='alert'>
										<button class='close' data-dismiss='alert'>&times;</button>
										<strong>Sorry, your balance is insufficient to make the transfer, please transfer a lower amount.</strong> 
									</div>
									<?php
								}
						?>
						<?php 
							if(isset($_GET['amounterror']))
								{
									?>
									<div class='alert'>
										<button class='close' data-dismiss='alert'>&times;</button>
										<strong>Sorry, the amount is too little, please transfer a higher amount.</strong> 
									</div>
									<?php
								}
						?> 
            
            
            
            
            
          <div class="row">
         
              <div class="col-12 col-xl-8 mb-4 mb-xl-0">
                  <h3 class="font-weight-bold"><?php echo welcome();  ?> <?php echo $row['fname']; ?> <?php echo $row['lname']; ?>   <div class="badge badge-success"><?php echo $row['type']; ?></div></h3>
                  <h5 class="font-weight-normal mb-0">Account Number: <div class="badge badge-danger"><?php
function mask_mobile_no($number)
{
    return substr($number, 0, 5) . '*****' . substr($number, -2);
}
$number = $row['acc_no']; 
echo mask_mobile_no($number) ;
?></div> </h5><br>
                </div>
                
                
            <div class="col-12 grid-margin stretch-card">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title">Inter Bank Transfer</h4>
                  <p class="card-description">
                    Interbank transfer enables electronic transfer of funds from the account of the remitter in one bank to the account of the beneficiary 
                  </p>
                 
                       <form class="forms-sample" autocomplete="off" method="POST" action="transfer_processing.php"> 
                      
                         <div class="form-group">
                      <label for="exampleSelectGender">Funding Account</label>
                        <select class="form-control" id="exampleSelectGender">
                          <option value="<?php echo $row['acc_no']; ?> | <?php echo $row['currency']; ?><?php echo $english_format_number = number_format( $row['a_bal'] , 2, '.', ','); ?>"><?php echo $row['acc_no']; ?> | <?php echo $row['currency']; ?><?php echo $english_format_number = number_format( $row['a_bal'] , 2, '.', ','); ?></option> 
                        </select>
                      </div>
                      
                      
                      
                      
                    <div class="form-group">
                      <label for="exampleInputName1">Amount (<?php echo $row['currency']; ?>)</label>
                           <span id="sprytf_amount">
                      <input type="number" class="form-control" id="amount" name="amount" placeholder="Amount" >
                            <span class="textfieldRequiredMsg">Sending Amount is required.</span>
                    			<span class="textfieldMinCharsMsg">minimum of $10.</span> 
                    		</span>
                    </div>
                    <div class="form-group">
                      <label for="exampleInputEmail3">Beneficiary Account <strong style="color:red;">*</strong></label> 
                       <span id="sprytf_acc_no">
                          <input type="number" class="form-control" id="acc_no" name="racc_no" placeholder="Receiver Account Number" >
                        <span class="textfieldRequiredMsg">Account Number is required.</span>
            			<span class="textfieldMinCharsMsg">min of at least 10 characters.</span>
            			<span class="textfieldMaxCharsMsg">max 15 characters.</span>
            			<span class="textfieldInvalidFormatMsg">Account Number must be Integer.</span>
                      
                       
                    </div>
                    <div class="form-group">
                      <label for="exampleInputPassword4">Beneficiary Name <strong style="color:red;">*</strong></label>
                      <span id="sprytf_acc_name">
                      <input type="text" class="form-control" id="acc_name" name="acc_name" placeholder="Receiver Account Name" >
                               <span class="textfieldRequiredMsg">Beneficiary Account Name is required.</span>
                    			<span class="textfieldMinCharsMsg">min of 8 characters.</span> 
                    		</span>
                    </div>
                   
                   
                    <div class="form-group">
                        
                       
                      <label for="exampleInputPassword4">Beneficiary Bank Name <strong style="color:red;">*</strong></label>
                       <span id="sprytf_bank_name">
                      <input type="text" class="form-control" id="bank_name" name="bank_name" placeholder="Receiver Bank Name" >
                               <span class="textfieldRequiredMsg">Bank Name is required.</span>
            			<span class="textfieldMinCharsMsg">min of 6 characters.</span> 
            		</span>
                                </div>
                    
                    
                    
                       <div class="form-group">
                      <label for="exampleSelectGender">Receiver Account Type</label>
                      
                        <select class="form-control"  name="type" required>
                            <option value="">Please select Account Type</option>
                          <option value="Savings Account">Savings Account</option>
                          <option value="Checking Account">Checking Account</option>
                          <option value="current Account">Current Account</option>
                          <option value="Cooporate Account">Cooporate Account</option>
                          <option value="Non Resident Account">Non Resident Account</option>
                          <option value="Joint Account">Joint Account</option>
                        </select>
             
                      </div>
                    
                    
                    
                    
                    
                     <div class="form-group">
                      <label for="exampleInputPassword4">Routing Number/Swift/IBAN</label>
                      <span id="sprytf_routing">
                      <input type="text" class="form-control" id="routing" name="swift" placeholder="Routing Number/Swift Code" >
                             <span class="textfieldRequiredMsg">US Routing Number/Swift is required.</span>
            			<span class="textfieldMinCharsMsg">min of 6 characters.</span> 
            		</span>
                    </div>
                    
             
                    
                    <input type="hidden" class="form-control" name="uname" value="<?php echo $row['email']; ?> "/>
                    <input class="form-control"  name="routing" type="hidden" value="<?php echo date("h:i A d M Y"); ?>" required>  
                    <input class="form-control"  name="cout" type="hidden" value="<?php echo $site_country; ?>" required> 
                    <input class="form-control" name="transtype" type="hidden" value="InterBank" required>
                            
                            
              
              
                    <div class="form-group">
                      <label for="exampleTextarea1">Purpose of Transfer <strong style="color:red;">*</strong></label>
                      <span id="sprytf_remarks">
                      <textarea class="form-control" name="remarks" placeholder="Write something.."  id="remarks" rows="4"></textarea>
                            <span class="textfieldRequiredMsg">Purpose of Transfer is required.</span>
            			<span class="textfieldMinCharsMsg">min of 15 characters.</span> 
            		</span>
                    </div>
                    <button type="submit" class="btn btn-primary mr-2"><i class=" 	fa fa-sign-in"></i> Transfer</button>
         
                  </form>
                </div>
              </div>
            </div>
             
           
          
   
          
          </div>
        </div>
        
        
        
        <?php include 'auth_footer.php'; ?>