<?php 
$INC_DIR = $_SERVER['DOCUMENT_ROOT']."/v1/app/";
include $INC_DIR."src/common.php";
$customer_details=get_customer_details($configs);
if(!empty($customer_details['purchases'])){
	$orderIds=array_column($customer_details['purchases'],"orderId");
	foreach($orderIds as $ord){
		sticky::confirm_order($configs,isset($ord)?$ord:"");
	}
	$lineitems=array_column($customer_details['purchases'],"items");
	$orderTotals=array_column($customer_details['purchases'],"totalAmount");
	$productIds=[];
	foreach($lineitems as $value){
		$val=end($value);
		$productIds[$val["name"]]=$val["price"];
	}
}
?>
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="utf-8"/>
<title><?php echo $configs->page_title; ?></title>
<meta name="description" content="<?php echo $configs->step_1_name; ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="content-language" content="en-us" />
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width,user-scalable=no"/>
<link href="css/app.css" rel="stylesheet">
<link href="brand/logo.png" rel="stylesheet">
<link rel="stylesheet" href="css/upsells/bootstrap.min.css">
<link rel="stylesheet" href="css/ty-style.css">
    <style>.addNewD{
            text-align: center;
        }
        .pic_1{
            display: inline-block;
        }
    </style>

	<script>
        history.pushState(null, null, window.location.href);
        history.back();
        history.forward(); 
        window.onpopstate = function () { history.go(1); };
    </script>
</head>
<body>
             <div class="container">
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="header clearfix" style="border-bottom:1px solid #ccc;margin-bottom:15px;padding-bottom:5px;">
                        <nav>
                            <ul class="nav nav-pills pull-right">
                                <li role="presentation">
                                    <h3><a href="tel:-<?php echo $configs->customer_service_number; ?>">Customer Service Support: <span style="font-weight:bold;color:#000;" class="active">US: <?php echo $configs->customer_service_number; ?> </span>
                                        </a>
                                    </h3>
                                </li>
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
						<div class="row">
							<div class="col">
                <div id="success" class="alert alert-success" role="alert">
                    <span class="lead text-center">
                    <strong>Thank You!</strong> Your order will be shipped within 1 business day!  You can expect it to arrive in 3-5 days after shipment.
                    </span>
                </div>
							</div>
						</div>
            <div class="row">
							<div class="col-sm-12 col-md-6 text-center">
                <img src="images/checkmark.gif"  width="92" height="91" alt="" />
                <br> 
																	<img src="brand/product.png" width="245" height="205" class="img-responsive pic_1" alt="" />
															</div>
				<div class="col-sm-12 col-md-6">
					<h1>Your Order is Confirmed</h1>
					<p>We are happy you have chosen to achieve your male enhancement goals with one of the most effective and the hottest products on the market.</p>
					<p>Your order is currently being processed and will be shipped within 1 business day. You’ll receive a shipping confirmation email with a tracking number once your product ships. If for some reason you don’t receive that email, contact our customer service team immediately so we may investigate the issue – US:  <span id="gc-number-1" class="gc-cs-link" title="Call with Google Voice"><a href="tel:<?php echo $configs->customer_service_number; ?>"><?php echo $configs->customer_service_number; ?></a></span> </span>
									</p>
					<h4>We are 100% committed to your product satisfaction and male enhancement goals</h4>
					<p><span> Call us if you have any problems with your purchase – Customer Service Number: US:  <span id="gc-number-2" class="gc-cs-link" title="Call with Google Voice"><a href="tel:<?php echo $configs->customer_service_number; ?>"><?php echo $configs->customer_service_number; ?></a></span> . Customer Service hours can be reached between </span></p>
									
					<!-- <h4>Order Summary</h4>
					<table class="table">
						<tbody>
						<?php foreach($productIds as $p => $v): ?>
							<tr>
							<td><?php echo $p; ?></td>
							<td>$<?php echo $v; ?></td>
							</tr>
						<?php endforeach; ?>
						<?php if($_SESSION['step3_purchase']):?>
							<tr>
							<td><?=$configs->step3_product_name?></td>
							<td><?=$configs->step3_product_price?></td>
							</tr>
						<?php endif;?>	
						</tbody>
					</table> -->
				</div>
			</div>
						
						<div class="row">
							<div class="col text-center">
                <img src="images/footer-logos-image.png" width="960" height="87" class="center-block img-responsive" alt="">
                <br>
                <div class="col-lg-12 content centered" style="font-size:12px;">
                    <div id="disclaimers">
                        <p></p>
                        <center>
                              [ <a href="javascript:void(0);" onClick="openNewWindow('disclosures/terms.php','modal');">Terms & Conditions</a> ] 
                             [ <a href="javascript:void(0);" onClick="openNewWindow('disclosures/privacy.php','modal');">Privacy Policy</a> ]
                             | Toll Free<a href="tel:<?php echo $configs->customer_service_number; ?>"> <?php echo $configs->customer_service_number; ?></a>
                            <br>
                        </center>
                        <br>
                        <br>
                        <center>
                            <?php echo $configs->step_1_name; ?> is committed to maintaining the highest quality products and the utmost integrity in business practices. All products sold on this website are certified by Good Manufacturing Practices (GMP), which is the highest standard of testing in the supplement industry.
                        </center>
                        <p></p>
                        <p></p>
                        <p></p>
                        <center>
                            Notice: The products and information found on this site are not intended to replace professional medical advice or treatment. These statements have not been evaluated by the Food and Drug Administration. These products are not intended to diagnose, treat, cure or prevent any disease. Individual results may vary.
                        </center>
                        <br>
                        <br>© <script type="text/javascript">var year = new Date();document.write(year.getFullYear());</script> <?php echo $configs->step_1_name; ?>, All rights reserved
                        <br>
                        <p></p>
                    </div>
                </div>
							</div>
						</div>
		<script type="text/javascript" src="js/jquery-3.6.0.min.js"></script> 
		<script type="text/javascript">
		    // Popup JS
		    function openNewWindow(page_url, type, button, window_name, width, height, top, left, features) {

		        if (!type) {
		            type = 'popup';
		        }

		        if (!width) {
		            width = 480;
		        }

		        if (!height) {
		            height = 480;
		        }

		        if (!top) {
		            top = 50;
		        }

		        if (!left) {
		            left = 50;
		        }

		        if (!features) {
		            features = 'resizable,scrollbars';
		        }

		        if (type == 'popup') {
		            var settings = 'height=' + height + ',';
		            settings += 'width=' + width + ',';
		            settings += 'top=' + top + ',';
		            settings += 'left=' + left + ',';
		            settings += features;

		            win = window.open(page_url, window_name, settings);
		            win.window.focus();
		        } else if (type == 'modal') {
		            var html = '';
		            html += '<div id="app_common_modal">';
		            html += '<div class="app_modal_body"><a href="javascript:void(0);" id="app_common_modal_close">X</a><div id="p-frame"></div>';
		            if (button) {
		                html += '<div id="bottom"><p>Please scroll down to activate Accept button</p><button onclick="chkBox()" disabled="disabled">' + button + '</button></div>';
		            }

		            html += '</div></div>';

		            if (!$('#app_common_modal').length) {
		                $('body').append(html);
		            }
		            $('#app_common_modal').fadeIn();
		        }
		        // Hide Popup
		        $('#app_common_modal_close').click(function () {
		            $('#app_common_modal').remove();
		        });


		        $.ajax({
		            url: page_url,
		        }).done(function (data) {
		            $('#p-frame').html(data);
		            $('#p-frame').scroll(function () {
		                if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight - 50) {
		                    $('#bottom button').removeAttr('disabled');
		                }
		            })

		        });

		    }
		</script>

    </body>
</html>