<?php include("includes/header.php"); ?>
<?php include("includes/auto_out.php"); ?>
<!DOCTYPE html>
<html>
<head>
  <title>Apply For Card | <?php echo $sitename; ?></title>
  
     <!----------------------------------------------------------------------->
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
     <script src="bootstrap/js/jquery.min.js"></script>
     <script src="bootstrap/js/bootstrap.min.js"></script>
     <!----------------------------------------------------------------------->
     <link rel="icon" href="images/fav-icon.ico" type="image/x-icon" />
    <!-- <link rel="shortcut icon" href="images/fav-icon.ico" type="image/x-icon" />
     <!----------------------------------------------------------------------->
     <!-------------------Constumized CSS--------------------------->
     <link rel="stylesheet" type="text/css" href="css/style.cs">

     <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
     <style>
        body{
          background-color: #f5f5f5;
        }
      .icons-links{
        text-decoration: none;
        color: #555;
        font-size: 16px;
        font-weight: bolder;
      }
      .icons-links:hover{
        color:#0c2074;
        text-decoration: none;
      }
     </style>
     
</head>
<body>
  <?php  include("includes/dashboard_nav.php"); ?>
    <br>
  <div class="container-fluid">
    

        <div class="row">
      <div class="col-sm-2">
        <?php include("includes/sidebar.php"); ?>
          <?php include("includes/side.php"); ?>
      </div>
      <div class="col-sm-10">
               <div class="row">

                   <!------------------LEFT ROW ---------------------------->
                   <div class="col-sm-5">
                       
                      
                     
                       <!------------------------------------------------------>

                       <div class="row">
                         <div class="col-sm-12">
                            <div class="panel panel-default">
                             <div class="panel-body">
                               <h4 style=""><img src="images/4021708.png" width="28">  APPLY FOR CARD</h4>
                               <hr>

                               <div class="row">

                                <div class="col-sm-12" align="">


                                  <?php
                                    if(isset($_POST["cardbtn"])){

                                      //GET ALL VAIRABLES
                                      $my_account = $_POST["my_account"];
                                      $card_name = $_POST["card_name"];
                                      $card_type = $_POST["card_type"];

                                      $card_shipment_address = "$address1, $city, $state, $country, $zipcode";
                                     
                                      $confirm_password = $_POST["confirm_password"];
                                      $card_status = "PENDING";
                                      $card_date = date("M d, Y");

                                      //Check if password is correct with db pass
                                      if($b_password == $confirm_password){

                                        //Check if account balance is > 1k usd
                                        if(($account_balance*1) >= 1000){

                                            
                                            //INSERT INTO Db
                                            $query = mysqli_query($conn, "INSERT INTO card_trans VALUES('', '$u_dbid', '$my_account', '$card_name', '$card_type', '$card_shipment_address', '$card_status', '$card_date')");
                                            echo "<div class='alert alert-success'><i class='glyphicon glyphicon-ok'></i> Your loan application has been sent.</div>";

                                            echo "<script>window.location.assign('request-cards.php');</script>";



                                        }else{
                                          echo "<div class='alert alert-danger'><i class='glyphicon glyphicon-warning-sign'></i> Insufficient Balance.</div>";
                                        }

                                       

                                      }else{
                                        echo "<div class='alert alert-danger'><i class='glyphicon glyphicon-warning-sign'></i> Unable to confirm password.</div>";
                                      }

                                    }
                                  ?>



                                   <form action="" method="POST">
                                     <div class="form-group">
                                      <label>My Account:</label>
                                       <select class="form-control input-lg" name="my_account" style="border-radius: 0px;">
                                         <option><?php echo $account_number; ?> - <?php echo ucfirst($firstname)."&nbsp;".ucfirst($middlename)."&nbsp;".ucfirst($lastname) ?></option>
                                       </select>

                                       <br>

                                       <label>Card Name:</label>
                                       <select class="form-control input-lg" name="card_name" style="border-radius: 0px;">
                                         <option>VISA</option>
                                         <option>MAESTRO</option>
                                         <option>AMEX</option>
                                         <option>DISCOVER</option>
                                       </select>

                                       <br>

                                       <label>Card Type:</label>
                                       <select class="form-control input-lg" name="card_type" style="border-radius: 0px;">
                                         <option>DEBIT</option>
                                         <option>CREDIT</option>
                                       </select>

                                       <br>

                                       <div class="alert alert-info">
                                         <img src="images/3142292.png" width="50">
                                         <br><br>
                                         <h4 style="font-weight: bold;">SHIPPING DETAILS</h4>
                                         <p>Check up on your shipping details/address below to confirm.</p>
                                       

                                         <div class="row">

                                          <div class="col-sm-12">
                                            <h3 style="font-weight: bold;"><?php echo $country; ?></h3>
                                            <div style="margin-top: -8px;"><p style="font-size: 16px;"><?php echo $city; ?>, <?php echo $state; ?> <img type="image" src="images/2603724.png" width="28" style="margin-top:-2px;"></p></div>
                                            <div style="margin-top: 0px;"><p style="font-size: 15px;"><img src="images/927667.png" width="17"> &nbsp;<?php echo $address1; ?>, <?php echo $zipcode; ?> </p></div>
                                            <br>
                                          </div>
                                           
                                         </div>
                                       </div>
                                       <br>

                                       <label>Confirm Password:</label>
                                       <input type="password" class="form-control input-lg" name="confirm_password" style="border-radius: 0px;" placeholder="********" autocomplete="none" required/>

                                       <br>

                                       <button type="submit" name="cardbtn" class="btn btn-primary" style="border-radius: 0px;">Apply</button>
                                     </div>
                                   </form>
                                </div>


                                 
                               </div>

                               <br>
                               
                             </div>
                           </div>
                         </div>
                       </div>
                       <!------------------------------------------------------>
                       
                   </div>
                   <!-----------------/LEFT ROW ---------------------------->

                   <!------------------------------------------------------->

                   <!------------------RIGHT ROW --------------------------->
                   <div class="col-sm-4">

                  
                    
                   </div>
                   <!-----------------/RIGHT ROW --------------------------->
               </div>
      </div>
    </div>
  </div>
</body>
</html>