<!-- Script PHP/MYSQL of management of classifieds ads developed by Script PAG. Script PAG all rights reserved. Use under license. http://www.script-pag.com -->
<div class="container-100">
	<div class="container-100-child payment-container">
		
		<h1><?php echo $info_page; ?></h1>
		
		<div class="not-mobile">
			<div class="flex-container">
				<p><?php echo $language['price_page_payment_item']; ?></p>
				<p><?php echo $language['price_page_payment']; ?></p>
				<?php if(!empty($price_vat)) : ?>
				<p><?php echo $language['price_vat_page_payment']; ?></p>
				<?php endif; ?>
				<?php if(!empty($_SESSION['discount_code'])) : ?>
				<p><?php echo $language['price_discount_page_payment']; ?></p>
				<?php endif; ?>
				<p><?php echo $language['price_total_page_payment']; ?></p>
			</div>
				
			<div class="flex-container">
				<p><?php echo $itemname; ?></p>
				
				<p><?php echo $price_without_vat .' '. $param_gen['currency']; ?></p>
				
				<?php if(!empty($price_vat)) : ?>
				<p><?php echo $price_vat .' '. $param_gen['currency']; ?></p>
				<?php endif; ?>
				
				<?php if(!empty($_SESSION['discount_code'])) : ?>
				<p><?php echo $_SESSION['discount_code']; ?></p>
				<?php endif; ?>
				
				<p><?php echo $price_total .' '. $param_gen['currency']; ?></p>
			</div>
			
			<div class="ref">
				<p><?php echo $language['price_ref_page_payment'] .' : '. $id_purch; ?></p>
			</div>
		</div>
		
		<div class="mobile">
			<div class="flex-container">
				<p class="title"><?php echo $language['price_page_payment_item']; ?></p>
				<p><?php echo $itemname; ?></p>
				<p class="title"><?php echo $language['price_page_payment']; ?></p>
				<p><?php echo $price_without_vat .' '. $param_gen['currency']; ?></p>
				<?php if(!empty($price_vat)) : ?>
				<p class="title"><?php echo $language['price_vat_page_payment']; ?></p>
				<p><?php echo $price_vat .' '. $param_gen['currency']; ?></p>
				<?php endif; ?>
				<?php if(!empty($_SESSION['discount_code'])) : ?>
				<p class="title"><?php echo $language['price_discount_page_payment']; ?></p>
				<p><?php echo $_SESSION['discount_code']; ?></p>
				<?php endif; ?>
				<p class="title"><?php echo $language['price_total_page_payment']; ?></p>
				<p><?php echo $price_total .' '. $param_gen['currency']; ?></p>
			</div>
			
			<div class="ref">
				<p><?php echo $language['price_ref_page_payment'] .' : '. $id_purch; ?></p>
			</div>
		</div>
		
		<h2 class="billing-title"><?php echo $language['form_billing_title']; ?></h2>
		<form id="billing-form" method="POST" action="<?php echo URL_DISPLAY; ?>/includes/display/save_billing.php"<?php echo (!empty($billing) ? ' style="display: none;"' : ''); ?>>
			<div class="forms">
				<p class="p-error"><?php echo $language['form_billing_error']; ?></p>
				<input type="hidden" name="id_purch" value="<?php echo $id_purch; ?>" />
				
				<?php if(isset($status) && $status == 2) : ?>
				<input type="text" name="company" value="<?php echo (isset($billing['company']) ? $billing['company'] : ''); ?>" placeholder="<?php echo $language['form_billing_company']; ?>" />
				<?php endif; ?>
				
				<input type="text" name="name" value="<?php echo (isset($billing['name']) ? $billing['name'] : ''); ?>" placeholder="<?php echo $language['form_billing_name']; ?>" />
				<input type="text" name="first_name" value="<?php echo (isset($billing['firstname']) ? $billing['firstname'] : ''); ?>" placeholder="<?php echo $language['form_billing_firstname']; ?>" />
				<input type="text" name="address" value="<?php echo (isset($billing['address']) ? $billing['address'] : ''); ?>" placeholder="<?php echo $language['form_billing_address']; ?>" />
				
				<?php if ($cache_param_fields['act_postcode'] == 1) : ?>
				<input type="text" name="postcode" value="<?php echo (isset($billing['postcode']) ? $billing['postcode'] : ''); ?>" placeholder="<?php echo $language['form_billing_postcode']; ?>" />
				<?php endif; ?>
				
				<?php if($cache_param_fields['act_city'] == 1) : ?>
				<input type="text" name="city" value="<?php echo (isset($billing['city']) ? $billing['city'] : ''); ?>" placeholder="<?php echo $language['form_billing_city']; ?>" />
				<?php endif; ?>
			</div>
			<input type="submit" name="billing_form" value="<?php echo $language['form_billing_submit']; ?>" />
		</form>
		<div id="billing-result" <?php echo (!empty($billing) ? ' class="billing-display"' : ''); ?>>
			<?php if(!empty($billing)) : ?>
				<p class="billing-resume"><?php echo (!empty($billing['company']) ? $billing['company'].'<br/>' : '').$billing['name'].' '.$billing['firstname'].'<br/>'.$billing['address'].'<br/>'.$billing['postcode'].' '.$billing['city']; ?></p>
			<?php endif; ?>
			<button id="edit-billing" type="button"><?php echo $language['form_billing_edit_button']; ?></button>
		</div>
		
		<div class="payment-type"<?php echo (!empty($billing) ? ' style="display: block;"' : ''); ?>>
			<h3><?php echo $language['choice_page_payment']; ?></h3>
			
			<div class="flex-container">
	
				<?php
				
					///////////////////////////////////
					//Account credits
					//////////////////////////////////
			
					if($acc_credit != NULL && $acc_credit >= $price_total && preg_match('#'. $language['item11_page_payment'] .'#', $itemname) != true)
					{
						echo '<div><p>
						'. $language['payment_by_credit'] .'<br />
						'. $language['payment_by_credit_2'] .' <strong>'. $acc_credit .' '. $param_gen['currency'] .'</strong> '. $language['payment_by_credit_3'] .'
						</p>
						<form action="payment_free.php" method="post">
							<input type="hidden" name="id_acc" value="'. $id_acc .'" />
							<input type="hidden" name="id_purch" value="'. $id_purch .'" />
							<input type="hidden" name="price" value="'. $price_total .'" />
							<input type="submit" name="" value="'. $language['payment_by_credit_4'] .'" />
						</form>
						</div>';
					}
					else if($acc_credit != NULL && $acc_credit < $price_total && preg_match('#'. $language['item11_page_payment'] .'#', $itemname) != true)
					{
						echo '<div><p>
						'. $language['payment_by_credit'] .'<br />
						'. $language['payment_by_credit_2'] .' <strong>'. $acc_credit .' '. $param_gen['currency'] .'</strong> '. $language['payment_by_credit_3'] .'
						</p>
						<p><a href="purchase_credit.php?id_acc='. $id_acc .'" class="button" />'. $language['account_dashboard_credit_submit'] .'</a></p>
						</div>';
					}
		
					///////////////////////////////////
					//Paypal
					//////////////////////////////////		
					
					if($cache_pay_paypal['active'] == 1)
					{
						echo '<div id="paypal-container">';
						require_once(__DIR__.'/../includes/payment/paypal/checkoutView.php');
						echo '</div>';
					}
					
					pool::execute('displayPaymentMethod', $purchase, $itemname);
			
					?>
			</div>
			
			<?php
				
				///////////////////////////////////
				//Others
				//////////////////////////////////	
				
				if($cache_pay_others['act_others'] == 1)
				{
					echo '<div class="other"><h3>'. $language['manual_page_payment'] .'</h3>';
					
					if(is_array($cache_pay_others['text'])) {
						echo stripslashes($cache_pay_others['text'][$_SESSION['code_lang']]);
					} else {
						if($cache_pay_others['act_html'] == 1)
						echo '<p>'. $cache_pay_others['text'] .'</p>';
						
						else echo '<p>'. nl2br(htmlspecialchars($cache_pay_others['text'])) .'</p>';
					}
					echo '</div>';
				}
				
			?>

		</div>

	</div>
</div>