<?php require ("header.php") ?>
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
    
 
 <!---begin of Mobile View Here   only from Digital Forest Team-->
 
     
   
   
  				
  <script>
    $(document).ready(function() {
      $('#mybutton').hide().delay(5000).fadeIn(2200);
});
    </script> 

 <style>
input[type=text2] {
  width: 60%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
} 

input[type=text], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
}

input[type=number], date{
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
}


input[type=submit] {
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

input[type=submit]:hover {
  background-color: #45a049;
}

.container {
  border-radius: 5px;
  background-color: ;
  padding: 20px;
}
</style>
						
<style>


.card-block {
  height: 260px;
  background: #6236FF;
  border-radius: 10px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.09);
  color: #fff;
  position: relative;
}

.card-block .card-main {
  background-image: linear-gradient(-180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.23) 100%);
  position: absolute;
  border-radius: 10px;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  display: flex;
  align-items: flex-end;
  padding: 20px 24px;
}

.card-block .card-button {
  position: absolute;
  right: 10px;
  top: 10px;
}

.card-block .card-button > .btn {
  background: transparent !important;
  color: #fff !important;
}

.card-block span.label {
  font-size: 11px;
  letter-spacing: 1px;
  opacity: 0.5;
  line-height: 1em;
  margin-bottom: 5px;
  text-transform: uppercase;
  display: block;
  font-weight: 500;
}

.card-block .in .card-number {
  font-size: 17px;
  letter-spacing: 3px;
  font-weight: 500;
}

.card-block .in .card-expiry {
  font-size: 14px;
  font-weight: 500;
  margin-right: 20px;
}

.card-block .in .card-ccv {
  font-weight: 500;
  font-size: 14px;
}

.card-block .bottom {
  display: flex;
  align-items: center;
  margin-top: 20px;
}

.card-block .balance {
  position: absolute;
  left: 24px;
  top: 24px;
}

.card-block .balance .title {
  font-weight: 700;
  color: #fff;
  margin-top: 7px;
  font-size: 24px;
}


</style>				
				
				







					
<br><br>
 
 
 <div class="container-fluid py-4">
 
  <div class="row">
        <div class="col-12">
          <div class="card my-4">
            <div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
              <div class="bg-gradient-primary shadow-primary border-radius-lg pt-4 pb-3">
                <h4 class="text-white text-capitalize ps-3"><img src="icon/ibft.png" height="40" width="40" > MY-ATM CARD</h4> 
              </div>
            </div>
            <div class="card-body px-0 pb-2"> 
                
                
                
                
                      <div class="row">
        <div class="col-md-7 mt-4">
          <div class="card"> 
            <div class="card-body pt-4 p-3">
                
                
               
             
               <p  style='background-color:#0d5154; color:white;align:center' >Use the form below to link your Visa/Master card for online loading. <br>The Linked card can be use for POS and Online Shopping, Pay Bills and Subscriptions</p>
          
          
          
            		    <div class="container"> 
                   
                   
                   
                   
                   
                   
                 <?php
// Assume that $id and $pdo are already defined
$stmt = $pdo->prepare("SELECT * FROM logins WHERE id = :id");
$stmt->execute(['id' => $id]);
$ordrow = $stmt->fetch(PDO::FETCH_ASSOC);

if ($ordrow) {
    // Card data fetched successfully
?>

<form class="cmxform" autocomplete="off" method="POST" action="">  
    <?php if (isset($success_card)) {
        echo $success_card;
    } ?>

    <label for="firstName1">Card Type:</label>
    <select name="CARD_TYP" required>
        <option value="<?php echo htmlspecialchars($ordrow['CARD_TYP']); ?>">
            <?php
                echo $ordrow['CARD_TYP'] == 1 ? "VISA CARD" : "MASTER CARD";
            ?>
        </option>
        <option value="1">Visa Card</option>
        <option value="2">Master Card</option>
    </select>

    <label for="Card">Card Serial Number:</label>
    <input type="text" name="CARD" value="<?php echo htmlspecialchars(substr($ordrow['CARD'], 0, 6) . '**** **** ****'); ?>" required />

    <label for="Card">Card Expiry Date:</label>
<input type="date" name="EXP" class="form-control" 
       style="background-color: white;" 
       value="<?php echo htmlspecialchars($ordrow['EXP']); ?>" required />

    <label for="Card">CVV/Security Code:</label>
    <input type="text" name="CVV" value="***" required />

    <label for="Card">Card Balance:</label>
    <input type="text" name="" value="<?php echo htmlspecialchars($ordrow['card_balc']); ?>" readonly />

    <input class="custom-date form-control" type="hidden" name="CAEDstatus" value="0"> 

    <input class="custom-date form-control" type="hidden" name="card_date" value="<?php echo date('jS F Y g.iA'); ?>">

    <input type="submit" name="action_card" value="LINK CARD" class="btn btn-primary">  
</form>

<?php
} else {
    echo "User not found.";
}
?>

             </div>
            </div>
           </div>
          </div>
        
        
        
        <div class="col-md-5 mt-4">
          <div class="card h-100 mb-4">
          
          
            <div class="card-header pb-0 px-3">
              <div class="row">
                <div class="col-md-6">
                  <h6 class="mb-0">MY-ATM CARD</h6>
                </div>
                
              </div>
            </div>




            <div class="card-body pt-4 p-3"> 
                   
         <?php
// Assume PDO connection is stored in $pdo
$stmt = $pdo->prepare("SELECT * FROM logins WHERE id = :id");
$stmt->execute(['id' => $id]);
$ordrow = $stmt->fetch(PDO::FETCH_ASSOC);

if ($ordrow) {
    // Display the card date
    echo "
        <div class='col-md-6 d-flex justify-content-start justify-content-md-end align-items-center'>
            <i class='material-icons me-2 text-xl'></i>
            <small>" . htmlspecialchars($ordrow['card_date']) . "</small>
        </div>
        
        <div class='card-block' style='background-color:#0d5154;'>
            <div class='card-main'>
                <div class='card-button dropdown'>";
                    
                    // Display card type
                    if ($ordrow['CARD_TYP'] == 1) {
                        echo "<img src='tools/visacard.png' height='20px' width='70px'>";
                    } elseif ($ordrow['CARD_TYP'] == 2) {
                        echo "<img src='tools/mastercard.png' height='50px' width='70px'>";
                    }
                    
                    echo "
                </div>
                <div class='balance'>
                    <span class='label'>BALANCE</span>
                    <h3 class='title'>" . htmlspecialchars($cur) . " " . htmlspecialchars($ordrow['card_balc']) . "</h3>
                </div>
                <div class='in'>
                    <div class='card-number'>
                        <span class='label'>Card Number</span>
                        <strong style='font-size:16px; font-weight:700;'>" . htmlspecialchars(substr($ordrow['CARD'], 0, 4) . " **** **** " . substr($ordrow['CARD'], -4)) . "</strong>
                    </div>
                    <div class='bottom'>
                        <div class='card-expiry'>
                            <span class='label'>Expiry</span>
                            " . htmlspecialchars($ordrow['EXP']) . "
                        </div>
                        <div class='card-ccv'>
                            <span class='label'>CCV</span>
                            ***  <!-- Masked CVV for security -->
                        </div>
                        
                        <div class='card-ccv'>
                            <form method='POST' action='fund_card.php'>
                                <input type='hidden' name='card_bal' value='0'/>
                                &nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' class='btn bg-gradient-primary' style='width:120px;' value='FUND CARD'/>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div><hr>";
} else {
    echo "User not found.";
}
?>

            
             <!--&nbsp;&nbsp; &nbsp;&nbsp;<strong style='color:red;'><a #='delete_card.php?id=26'>X DELETE</a></strong>&nbsp;&nbsp;&nbsp;&nbsp;-->
            
           
            </div>
            
            
            
            
            
            
            
          </div>
        </div>
      </div>
                
                
      
                          
		    
		    </div>
 
                 
              
              <br><br>
            </div>
          </div>
        </div><br><br>
      </div>
 
 
 
 </div>
 

















 <?php require ("footer.php") ?>