<?php 
include_once 'class.crud.php';
if(isset($_POST['btn-updatet']))
{
	$id = $_GET['edit_id'];
	$email = $_POST['email'];
	$bank_name = $_POST['bank_name'];
	$acc_name = $_POST['acc_name'];
	$acc_no = $_POST['acc_no'];
	$amount = $_POST['amount'];
	$routing = $_POST['routing'];
	$status = $_POST['status'];
	$swift = $_POST['swift'];
	$type = $_POST['type'];
	$remarks = $_POST['remarks'];
	
	
		$statement = $DB_con->prepare("SELECT  A.email, A.t_bal, B.currency from A FULL JOIN B ON A.email = B.email");
		
		$row = $statement->fetch(PDO::FETCH_ASSOC);

	if($crud->updatet($id,$email,$bank_name,$acc_name,$acc_no,$amount,$routing,$status,$swift,$type,$remarks))
	
  
		$msg = "<div class='alert alert-info'>
				Transfer Record was updated successfully <a href='index.php'>HOME</a>!
				</div>";
	}
	else
	{
		$msg = "<div class='alert alert-warning'>
				<strong>SORRY!</strong> ERROR while updating record !
				</div>";
	}

if(isset($_GET['edit_id']))
{
	$id = $_GET['edit_id'];
	extract($crud->getIDt($id));	
}

?>



 <?php include 'headeradmin.php'; ?>
 

 <!---begin of Mobile View Here   only from Digital Forest Team-->
 
       <?php include 'menu.php'; ?>
  
  <!---End of Mobile View Here   only from Digital Forest Team-->
  
 
     
      <br><br><br><br><br><br><br>
     
  
    <div class="container-fluid mt--7">
     <!-- Table -->
      <div class="row">
        <div class="col">
          <div class="card shadow" >
            <div class="card-header border-0">
              <h3 class="mb-0"><a href=""   class="btn btn-danger">EDIT CUSTOMER TRANSACTION INFORMATION</a></h3>
            </div>
          
           <div class="card-body">
               
               <?php
if(isset($msg))
{
	echo $msg;
}
?>
               
               
                                              <div class="container-fluid">
	<form method='post' class=''>
 
         <div class="row">
         <div class="form-group col-md-3">
            <label for="name">EMAIL</label>
			<input id="name" name="email" class="form-control" type="text" value="<?php echo $email;?>"  />
        </div>
		
        <div class="form-group col-md-3">
            <label for="name">BENEFICIARY BANK NAME</label>
			<input id="name" name="bank_name" class="form-control" type="text" value="<?php echo $bank_name;?>"  />
        </div>
  
        <div class="form-group col-md-3">
			<label for="acc_no">BENEFICIARY ACCOUNT NAME</label>
			<input id="acc_name" name="acc_name" class="form-control" type="text" value="<?php echo $acc_name;?>" />
        </div>
 
   </div>
 
  <div class="row">
        <div class="form-group col-md-3">
            <label for="website">BENEFICIARY ACCOUNT NO.</label>
			<input id="website" name="acc_no" class="form-control" type="text" value="<?php echo $acc_no;?>" />
        </div>
 
        <div class="form-group col-md-3">
			<label for="contact">AMOUNT </label>
			<input id="contact" name="amount" class="form-control" type="text" value="<?php echo $amount;?>" required />
        </div>
		
		<div class="form-group col-md-3">
			<label for="job">DATE</label>  <small>Input like this (YYYY-MM-DD HH:MM:SS)</small>
			<input id="job" name="routing" class="form-control" type="text" value="<?php echo $routing;?>" required />
        </div>
	</div>
	
	 <div class="row">
		<div class="form-group col-md-3">
		    <label>Transfer Status</label><small> <b>Current= <?php echo $status;?></b></small>
                            <select name="status" class="form-control input-sm validate[required]">
                                <option value="Pending">Pending</option>
                                <option value="Successful">Successful</option>
                                <option value="Failed">Failed</option>
                                <option value="Cancelled">Cancelled</option>
                                 <option value="On-hold">On-hold</option>
                            </select>
			
        </div>
		
		
         <div class="form-group col-md-3">
            <label for="name">SWIFT</label>
			<input id="name" name="swift" class="form-control" type="text" value="<?php echo $swift;?>"  />
        </div>
		
        <div class="form-group col-md-3">
            <label for="name">ACC. TYPE</label>
		  <select name="type" class="form-control input-sm validate[required]">
                                    <option value="Savings">Savings</option>
                                    <option value="Current">Current</option>
                                 </select>
        </div>
 </div>
        <div class="form-group col-md-3">
			<label for="acc_no">TRANSFER DESC.</label>
			<input id="acc_name" name="remarks" class="form-control" type="text" value="<?php echo $remarks;?>" />
        </div>
 
      
		<div class="clearfix"></div>
            <br />
        <table>
        <tr>
            <td colspan="2">
                <button type="submit" class="btn btn-success" name="btn-updatet">
    			<span class="glyphicon glyphicon-edit"></span>  UPDATE TRANSACTION
				</button>
                <a href="index.php" class="btn btn-large btn-primary"><i class="glyphicon glyphicon-backward"></i> &nbsp; CANCEL</a>
            </td>
        </tr>
        </table>
</form> 
</div>

               
               
               
               
               
               
               
               
          </div>
        </div>
      </div>
     </div>
 
    
       <?php include 'foot.php'; ?>