<?php
include_once 'class.crud.php';
if(isset($_POST['btn-update']))
{
	$id = $_GET['edit_id'];
	$loanamt = $_POST['loanamt'];
	$inter = $_POST['inter'];
	$dura = $_POST['dura'];
	$monthlypay = $_POST['monthlypay'];
	$balance = $_POST['balance'];
	$status = $_POST['status'];
	
	if($crud->updateloan($id,$loanamt,$inter,$dura,$monthlypay,$balance,$status))
	{
		$msg = "<div class='alert alert-info'>
				Customer Loan Updated Successfully <a href='index.php'>HOME</a>!
				</div>";
	}
	else
	{
		$msg = "<div class='alert alert-warning'>
				<strong>SORRY!</strong> ERROR while updating Loan!
				</div>";
	}
}

if(isset($_GET['edit_id']))
{
	$id = $_GET['edit_id'];
	extract($crud->getIDloan($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-->
  
 
      <script type="text/javascript" src="paginator.js"></script>
        <script type="text/javascript" src="table.js"></script>
     
     <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">Update Loan</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">Requested Loan Amount</label>
			<input id="name" name="loanamt" class="form-control" type="text" value="<?php echo $loanamt;?>"  />
        </div>
		
        <div class="form-group col-md-3">
            <label for="name">Interest Rate (3.1 %)</label>
			<input id="name" name="inter" class="form-control" type="text" value="<?php echo $inter;?>"  />
        </div>
 
        <div class="form-group col-md-3">
			<label for="email">Duration </label>
			<input id="lname" name="dura" class="form-control" type="text" value="<?php echo $dura;?>" />
        </div>
 
        <div class="form-group col-md-3">
            <label for="website">Monthly Payment ($400.00) </label>
			<input id="website" name="monthlypay" class="form-control" type="text" value="<?php echo $monthlypay;?>" />
        </div>
         <div class="form-group col-md-3">
            <label for="website">Loan Status (e.g APPROVED, PENDING, ON-HOLD, CANCELED, REVERSED</label>
			<input id="website" name="status" class="form-control" type="text" value="<?php echo $status;?>" />
        </div>
         <div class="form-group col-md-3">
            <label for="website">Loan Balance ($200,000.00)</label>
			<input id="website" name="balance" class="form-control" type="text" value="<?php echo $balance;?>" />
        </div>
 </div>
 
	 
 
		<div class="clearfix"></div>
            <br />
        <table>
        <tr>
            <td colspan="2">
                <button type="submit" class="btn btn-success" name="btn-update">
    			<span class="glyphicon glyphicon-edit"></span>  Update Loan
				</button>
                <a href="index.php" class="btn btn-large btn-danger"><i class="glyphicon glyphicon-backward"></i> &nbsp; CANCEL</a>
            </td>
        </tr>
        </table>
</form> 


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



