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

                <!-- main header @e -->
                <!-- content @s -->

                <div class="nk-content nk-content-fluid">
    <div class="container-xl wide-lg">
        <div class="nk-content-body">
            <div class="nk-block-head">
                <div class="nk-block-between-md g-4">
                    <div class="nk-block-head-content">
                        <h2 class="nk-block-title fw-normal">Card(s)</h2>
                        
                    </div>
                    <div class="nk-block-head-content">
                        <ul class="nk-block-tools gx-3">
                            
                            <li class="btn-wrap"><a href="virtual_card.php" class="btn btn-icon btn-xl btn-success"><em class="icon ni ni-wallet-in"></em></a><span class="btn-extext">Request Card</span></li>
                            
                        </ul>
                    </div>
                </div>
            </div><!-- .nk-block-head -->
            <div class="nk-block">
                <div class="card card-bordered">
                    <div class="card-inner">

                        <div class="row text-left">
                            <div class="col-12 text-left">
                                <div class="text-danger text-left mb-3">
                                    <h6>
                                        Hover on card to view CVV, Card Code, Disclamer etc.*
                                    </h5>

                                </div>
                            </div>
                        </div>

                                                   <?php
// Query the user data once
$ordsql = "SELECT * from logins WHERE id = :id"; 
$stmt = $pdo->prepare($ordsql);
$stmt->execute(['id' => $id]);
$ordrow = $stmt->fetch(PDO::FETCH_ASSOC);
?>

<div class="row text-center mb-5" style="text-align: center; align-content: center;">
    <div class="col-12">
        <div class="">
            <div class="mycard">
                <div class="mycard-inner">
                    <div class="front">
                        <img src="backend/user/images/map.png" alt="map" class="map-img">
                        <div class="myrow">
                            <img src="backend/user/images/chip.png" alt="Chip" style="width: 60px;">
                            <?php 
                            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'>";
                            }
                            ?>
                        </div>
                        
<style>
   .myrow.mycard-no {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 10px;
}

.myrow.mycard-no p {
    margin: 0;
    font-weight: bold;
}
.myrow.mycard-no {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 25px;
}

.myrow.mycard-no p {
    margin: 0;
    font-weight: bold;
}
</style>
                       
                       
                       
                       <div class="myrow mycard-no">
    <?php if (!empty($ordrow['CARD'])): ?>
        <p><?php echo substr($ordrow['CARD'], 0, -12); ?></p>
        <p><?php echo substr($ordrow['CARD'], 4, -8); ?></p>
        <p><?php echo substr($ordrow['CARD'], 8, -4); ?></p>
        <p><?php echo substr($ordrow['CARD'], -4); ?></p>
    <?php else: ?>
        <p>xxxx</p>
        <p>xxxx</p>
        <p>xxxx</p>
        <p>xxxx</p>
    <?php endif; ?>
</div>

                        
                        <div class="myrow mycard-holder">
                            <p>CARD HOLDER</p>
                            <p>VALID TILL</p>
                        </div>
                        <div class="myrow myname">
                            <?php 
                            if ($ordrow['CARD_TYP'] == 1 || $ordrow['CARD_TYP'] == 2) {
                                echo "<p>" . $ordrow['firstname'] . " " . $ordrow['lastname'] . "</p>";
                            } else {
                                echo "<small>xxxxx xxxxxx</small>";
                            }
                            ?>
                            <p><?php echo $EXP; ?></p>
                        </div>
                    </div>

                    <div class="back">
                        <img src="backend/user/images/map.png" alt="map" class="map-img">
                        <div class="code">
                            <span> SNL-6273NOD-26 </span>
                        </div>
                        <div class="bar"></div>
                        <div class="myrow mycard-cvv">
                            <div>
                                <img src="backend/user/images/pattern.png" alt="pattern">
                            </div>
                            <?php 
                            if ($ordrow['CARD_TYP'] == 1 || $ordrow['CARD_TYP'] == 2) {
                                echo "<p>" . $ordrow['CVV'] . "</p>";
                            } else {
                                echo "<small>xxx</small>";
                            }
                            ?>
                        </div>
                        <div class="myrow mycard-text">
                            <p>By using this card, the holder agrees to all the terms and condition under which it was issued. This card is issued by Garantii Finance pursuant to license by VISA &nbsp; International. It remains the property of the issuer and will be withdrawn upon misuse by card holder.
                                <br><br>
                                <strong style="text-transform: capitalize;">Garantii Finance, </strong> 24-Hours Customer Service.
                            </p>
                        </div>
                        <div class="myrow signature">
                            <p>CUSTOMER SIGNATURE</p>
                            <?php 
                            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'>";
                            }
                            ?>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

                        
                    </div><!-- .card-inner -->
                </div><!-- .card -->

            </div><!-- .nk-block -->
        </div>
    </div>
</div>

                <!-- content @e -->

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