<!DOCTYPE html>
<html lang="en-US">
<head>
    <title>Payment Successful - Golf Evolution</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php include 'member_layout/analyticscode.php' ?>
    <link rel="icon" href="<?= base_url()."/public"; ?>/assets/member_images/favicon.png" sizes="192x192" />
    <link rel="apple-touch-icon" href="<?= base_url()."/public"; ?>/assets/member_images/favicon.png" />
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="<?= base_url()."/public"; ?>/assets/member_css/front-style.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    <script src="<?= base_url()."/public"; ?>/assets/member_js/ajax.js"></script>
</head>
<body class="payment">

<?php include 'member_layout/header.php' ?>

<section>
    <div class="container">
        <div class="row">
            <div class="col-lg-2"></div>
            <div class="col-lg-8">
                <div class="payment-box">
                    <div class="row payment-head">
                        <div class="col-lg-12">
                            <div>
                                <img src="<?= base_url()."/public"; ?>/assets/member_images/Vector.png" alt="" width="60" height="60"/>
                                <h1 class="sucessful-heading">Payment Successful!</h1>
                                <p>The order confirmation has been sent to your registered mail id</p>
                            </div>
                        </div>
                    </div>

                    <div class="row aside">
                        <div class="col-lg-12">
                            <div class="row">
                                <div class="aside-content col-lg-4">
                                    <div class="trans-id label">Order Id</div>
                                    <div class="trans-id"><?= $order_id; ?></div>
                                </div>
                                <div class="aside-content col-lg-4">
                                    <div class="trans-date label">Transaction Date</div>
                                    <div class="trans-date"><?= $formattedDate; ?></div>
                                </div>
                                <div class="aside-content col-lg-4 aside-content-last">
                                    <div class="trans-method label">Payment Method</div>
                                    <div class="trans-method"><?= $card_brand; ?> card ending with <?= $last_4; ?></div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row order">            
                         <div class="col-lg-12 ps-0 pe-0">
                               <div class="order-heading">Your Order</div>
                         </div>      
                         <?php foreach ($memberCredits as $val) { ?> 
                       <div class="row total-list">                    
                            <div class="col-lg-6">                                                   
                                <div class="row">
                                    <div class="col-2 col-lg-2">
                                        <img src="<?= base_url()."/public"; ?>/assets/member_images/cart-icon.png" alt="" width="70" height="70">
                                    </div>
                                    <div class="col-10 col-lg-10">
                                        <div class="product-name"><?php echo $val['package_name']." ($".number_format($val['cost'], 2, '.', '')." x ".$val['pack_count'].")"; ?></div>

                                        <div class="credits-number"><?php echo $val['credit_points']; ?> Credits</div>
                                        <!-- <div class="credit-point">20+4 Credits Extra*</div>
                                        <div class="credit-price">1 Credit at $22.90</div> -->
                                    </div>
                                    <div class="col-lg-3"></div>
                                </div>
                            </div>
                        
                            <div class="col-12 col-lg-6 d-flex justify-content-end align-items-start">
                                <div class="order-total"><span class="price-symbol">$</span><?php echo number_format($val['costSum'], 2, '.', ''); ?></div>
                            </div>
                        </div>
                        <?php } ?>
                    </div>

                    <div class="total">

                        <div class="row total-list pt-0">
                            <div class="col-6 col-lg-6">
                                <div class="subtotal label">Subtotal</div>
                            </div>
                            <div class="col-6 col-lg-6 text-end">
                                <div class="subtotal"><span class="price-symbol">$</span><?= number_format($Subtotal, 2, '.', ''); ?></div>                            
                            </div>
                        </div>

                        <div class="row total-list">
                            <div class="col-4 col-lg-6">
                                <div class="taxes label">Taxes</div>
                            </div>
                            <div class="col-2 col-lg-2"></div>
                            <div class="col-3 col-lg-2 text-end">
                                <div class="taxes pst label">GST :</div>                            
                            </div>
                            <div class="col-3 col-lg-2 text-end">
                               <div class="taxes pst"><span class="price-symbol">$</span><?php $number = $Subtotal * $gst / 100;echo number_format($number, 2, '.', ''); ?></div>                            
                            </div>
                            <?php if($pst != 0){?>

                            <div class="col-lg-6">                               
                            </div>
                            <div class="col-lg-2"></div>
                            <div class="col-lg-2 text-end">
                                <div class="taxes gst label">PST :</div>                            
                            </div>
                            <div class="col-lg-2 text-end">
                               <div class="taxes gst"><span class="price-symbol">$</span><?php $number = $Subtotal * $pst / 100;echo number_format($number, 2, '.', ''); ?></div>                            
                            </div>
                            <?php }?>


                        </div>
                       
                        <div class="row sub-total-main">
                            <div class="col-6 col-lg-6">
                                <div class="order-total label">Total</div>
                            </div>
                            <div class="col-6 col-lg-6 text-end">
                                <div class="order-total"><span class="price-symbol">$</span><?php $number = $Subtotal + (($Subtotal * ($gst + $pst) ) / 100) ;echo number_format($number, 2, '.', ''); ?></div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="row dashboard">
                        <div class="col-lg-4"></div>
                        <div class="col-lg-4 text-center">
                            <a href="<?= base_url('member_home'); ?>" class="custom-btn">Return to Dashboard</a>
                        </div>
                        <div class="col-lg-4"></div>
                    </div>                        
                </div>
            </div>
            <div class="col-lg-2"></div>
        </div>
    </div>
</section>

<?php include 'member_layout/footer.php' ?>

</body>
</html>