<?php
  session_start();
   ob_start();
    require "../model/configuration.php";
  if(!isset($_SESSION['LOGIN_STATUS']))
  {
      header('location:../index.php');
  }
   $bank_id=$_GET['id'];
 
  
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><?php echo $_SESSION['title'];?></title>
<link rel='stylesheet' type='text/css' href='../css/fonts.googleapis.com/css_cd14c140.css' />
<!-- Bootstrap CSS -->
<link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css" />
<!-- Theme CSS -->
<link rel="stylesheet" type="text/css" href="../css/vendor.css" />
<link rel="stylesheet" type="text/css" href="../css/theme.css" />
<link rel="stylesheet" type="text/css" href="../css/utility.css" />
<link rel="stylesheet" type="text/css" href="../css/custom.css" />
</head>

<body class="dashboard-page">
<script> var boxtest = localStorage.getItem('boxed'); if (boxtest === 'true') {document.body.className+=' boxed-layout';} </script> 
<!-- Start: Theme Preview Pane -->


<!-- Start: Header -->
<header class="navbar navbar-fixed-top">
  
   <?php include_once("../include/top_menu.php");?> 
</header>

<!-- Start: Main -->
<div id="main"> 
  
  <!-- Start: Sidebar -->
  <?php include_once("../include/left_menu.php");?>

  <!-- Start: Content -->
  <section id="content_wrapper">
    <div id="topbar">
      <div class="topbar-left">
        <ol class="breadcrumb">
          <li class="crumb-icon"><a href="#"><span class="glyphicon glyphicon-home"></span></a></li>
          <li class="crumb-link"><a href="#">Bank</a></li>
          <li class="crumb-trail">Edit</li>
        </ol>
      </div>
      
    </div>
    
    
    <div id="content">
      <div class="row">
        <div class="col-md-5">
          <div class="panel">
            <div class="panel-heading"> <span class="panel-title"> <span class="glyphicon glyphicon-lock"></span> Bank Details Edit </span> </div>
            <div class="panel-body">
              <form class="cmxform form-horizontal" id="altForm" action="#" role="form" method="post" autocomplete="">
              <?php
				
                  $sqry=$db->execute("select * from bank where id='$bank_id'");
				  while($row=$sqry->fetch_assoc()){
				
				  ?>

                
                 <div class="form-group">
                  <label for="cp" class="col-lg-2 control-label">Bank Name</label>
                  <div class="col-lg-10">
                    <div class="input-group"><span class="input-group-addon"><i class="fa fa-hand-o-right"></i></span>
                      <input id="name" name="b_name" type="text" class="form-control"  required="" value="<?php echo  $row['bankname'] ?>" autocomplete="off" />
                    </div>
                  </div>
                </div>
                
                
                
                <div class="form-group">
                  <label for="cp" class="col-lg-2 control-label">Account Number</label>
                  <div class="col-lg-10">
                    <div class="input-group"><span class="input-group-addon"><i class="fa fa-hand-o-right"></i></span>
                    <input type="text" name="acc_no" class="form-control" placeholder="Account Number" value="<?php echo $row['acc_no'] ?>" />
                     </div>
                  </div>
                </div>
                
                
                
                
                <div class="form-group">
                  <label for="cp" class="col-lg-2 control-label">Branch</label>
                  <div class="col-lg-10">
                    <div class="input-group"><span class="input-group-addon"><i class="fa fa-envelope"></i></span>
                    <input id="text" name="branch" type="branch" class="form-control" placeholder="Branch" value="<?php echo $row['branch'] ?>" />
                     </div>
                  </div>
                </div>
                
  <div class="form-group">
                  <label for="cp" class="col-lg-2 control-label">Account  Balance</label>
                  <div class="col-lg-10">
                    <div class="input-group"><span class="input-group-addon"><i class="fa fa-hand-o-right"></i></span>
                    <input id="text" name="balance" type="balnce" class="form-control" placeholder="Account Balnce" value="<?php echo $row['balance'] ?>" />
                     </div>
                  </div>
                </div>
            
                <div class="form-group">
                <div class="col-lg-11">
                 
                   <button type="submit" name="bankedit" class="submit btn bg-purple pull-right">Update</button>
                 <a href="add_bank.php" class="btn bg-purple pull-left">Back</a>
                  </div>
                </div>
              </form>
            </div>
          </div>
          </div>
          <?php
				  }
		  ?>
           <?php
           if(isset($_POST['bankedit']))
     {
     $name = $_POST['b_name'];
	$acc_no = $_POST['acc_no'];
	$branch = $_POST['branch'];
	$balance=$_POST['balance'];
	
    $db->execute("update bank set bankname='$name',acc_no='$acc_no',branch='$branch',balance='$balance' WHERE id='$bank_id'");        
          
           header("location:add_bank.php"); 
           }
           
    
    ?>
    
    
          </div>
          
    
    
    
    
    
    
    
    
    
      <?php //include_once("dashboard_content.php");?>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    </div>
    
  </section>
  
  <!-- Start: Right Sidebar -->
  
</div>
<!-- End #Main --> 


<!-- jQuery --> 
<script type="text/javascript" src="../vendor/jquery/jquery-1.11.1.min.js"></script> 
<script type="text/javascript" src="../vendor/jquery/jquery_ui/jquery-ui.min.js"></script> <!-- Bootstrap --> 
<script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script> 

<!-- Page Plugins --> 
<script type="text/javascript" src="../vendor/plugins/validate/jquery.validate.js"></script>  
<script type="text/javascript" src="../vendor/plugins/morris/morris.js"></script> 
<script type="text/javascript" src="../vendor/plugins/datatables/js/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="../vendor/plugins/datatables/js/datatables.js"></script> 
<script type="text/javascript" src="../vendor/plugins/multiselect/bootstrap-multiselect.js"></script> 
<script type="text/javascript" src="../vendor/plugins/jvectormap/jquery-jvectormap.min.js"></script> 
<script type="text/javascript" src="../vendor/plugins/jvectormap/assets/jquery-jvectormap-us-lcc-en.js"></script> 
<script type="text/javascript" src="../vendor/plugins/clndr/clndr.js"></script> 
<script type="text/javascript" src="../vendor/plugins/clndr/moment.js"></script> 
<script type="text/javascript" src="../vendor/plugins/datepicker/bootstrap-datepicker.js"></script> 
<script type="text/javascript" src="../vendor/plugins/jquerymask/jquery.maskedinput.min.js"></script> 
<!-- Flot Plugins --> 
<script type="text/javascript" src="../vendor/plugins/jqueryflot/jquery.flot.min.js"></script> 

<!-- Theme Javascript --> 
<script type="text/javascript" src="../js/utility/spin.min.js"></script> 
<script type="text/javascript" src="../js/utility/underscore-min.js"></script> 
<script type="text/javascript" src="../js/main.js"></script> 
<script type="text/javascript" src="../js/ajax.js"></script> 
<script type="text/javascript" src="../js/custom.js"></script> 
<script type="text/javascript">
jQuery(document).ready(function () {
	  
	 "use strict";

     // Init Theme Core 	  
     Core.init();

     // Enable Ajax Loading 	  
     Ajax.init();     
     
	 
	 	
	 // validate the comment form when it is submitted
	 $("#altForm").validate();

	 //Init jquery Date Picker
	 $('.datepicker').datepicker()
	 
	 $('#datatable').dataTable( {
	"aoColumnDefs": [{ 'bSortable': false, 'aTargets': [ -1 ] }],
	"oLanguage": { "oPaginate": {"sPrevious": "", "sNext": ""} },
	"iDisplayLength": 5,
	"aLengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
	"sDom": 'T<"panel-menu dt-panelmenu"lfr><"clearfix">tip',
	"oTableTools": {
		"sSwfPath": "./vendor/plugins/datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
	}
  });	
  
  // Add Placeholder text to datatables filter bar
  $('.dataTables_filter input').attr("placeholder", "Enter Filter Terms Here....");
  
  // Manually Init Chosen on Datatables Filters
  $("select[name='datatable_length']").chosen();	
	
});
</script>
</body>
</html>