<?php
include("header.php");
include("modules/order.php");

if(isset($_GET['order_id'])){
	$order_id = $_GET['order_id'];
	$orderModule = new Orders();
	$orders = $orderModule->get_order($order_id);
}

$settings = new Settings();

$payments = $settings->getSettingPayment();

?>
          <!-- Content wrapper -->
          <div class="content-wrapper" id="main-Content">
          	<?php
          	if(isset($orders)){
          		?>
          		<div class="container-xxl flex-grow-1 container-p-y">
					<h4 class="fw-bold py-3 mb-4">Payment</h4>
					<div class="row mb-5">
						<div class="col-12">
							
							<div class="card mb-2">
								<h5 class="card-header">Products</h5>
							   	<div class="card-body">
					            
					            <table width="100%" border="0">
					            	
						        <?php
						        $order_total_price = 0;
								foreach ($orders as $key => $value) 
								{
									
								?>
					            	<tr>
					            		
					            		<td style="padding: 10px;background-color: #ffab0026;color: #000;" colspan="4" align="left">
											<p style="margin: 0px;font-size: 1em;">
												<?=$value->product_name?>
											</p>
										</td>
					            	</tr>
									<tr>
										<td colspan="1"></td>
										
										<td align="center">
											<p style="font-size: 1em;">
												x <?=$value->quantity?>
											</p>
										</td>
										<td>
											<p style="font-size: 1em;"><?=number_format($value->product_price)?>.- </p>
										</td>
										<td align="right">
											<p style="color:blue;font-size: 1.1em;"><?=number_format($value->product_total_price)?>.- </p>
										</td>
										
									</tr>
								
								<?php
								$order_total_price += $value->product_total_price;
								}
								?>
								<tr>
									<td colspan="4"><hr></td>
								</tr>
								<tr>
									<td colspan="3"></td>
									<td align="right"><p style="color:blue;font-size: 1.1em;"><?=number_format($order_total_price)?>.- </p> </td>
								</tr>
								</table>

								<hr>
								<?php
									foreach ($payments as $key => $payment) {
								?>
									<div class="row">
										<div class="col-12 col-md-3">
											<img width="100%" src="data:image/jpg;charset=utf8;base64,<?php echo base64_encode($payment->setting_qr_code); ?>" /> 
										</div>
										<div class="col-12 col-md-9">
											<table class="table">
									   			<tr>
									   				<td><h6>Bank Name</h6></td>
									   				<td><h6><b><?=$payment->setting_bank_name?></b></h6></td>
									   			</tr>
									   			<tr>
									   				<td><h6>Account Number</h6></td>
									   				<td><h6><b><?=$payment->setting_account_number?></b></h6></td>
									   			</tr>
									   			<tr>
									   				<td><h6>Account Name</h6></td>
									   				<td><h6><b><?=$payment->setting_account_name?></b></h6></td>
									   			</tr>
									   			<tr>
									   				<td colspan="2" align="left">
									   					<div class="alert alert-info" role="alert">
														  <h6><?=$payment->setting_remark?></h6>
														</div></td>
									   			</tr>
									   		</table>
										</div>
									</div>
								<?php
									}

								?>
								<hr>
							   	<div class="mb-3 row">
				                    <button type="button" onclick="order_confirm(this)" class="btn btn-success">Confirm</button>
			                  	</div>
					            </div>
					            

					        </div>

						</div>
					</div>
				</div>
	            
          		<?php
          	}
          	?>
          	
          </div>
<?php
include("footer.php");
?>

