
<?php

if($tpl['status'] == 'OK')
{
	if($tpl['event_arr']['status'] == 'T')
	{
		?>
		<div class="panel panel-default pjTbMain">
			<?php
			include_once dirname(__FILE__) . '/elements/header.php';
			$FORM = @$_SESSION[$controller->defaultForm];
			
			?>
			<form id="pjEtsPreviewForm_<?php echo $_GET['id'];?>" action="" method="post">
				<input type="hidden" name="ets_preview" value="1" />
				
				<div class="panel-body pjTbBody">
					<section class="pjTbSectionCheckout">
						<div class="pjTbForm pjTbFormCheckout">
							<?php
							include_once dirname(__FILE__) . '/elements/booking_details.php';
							
							if(isset($tpl['price_arr']['ticket_arr']))
							{
								foreach($tpl['price_arr']['ticket_arr'] as $k => $ticket)
								{
									if($ticket['attendee_name'] == 'yes')
									{
										?>
										<section class="pjTbFormSection">
											<p class="pjTbFormSectionTitle"><?php echo pjSanitize::html($ticket['title']);?></p><!-- /.pjTbFormSectionTitle -->
				
											<div class="form-horizontal">
												<?php
												for($i = 1; $i <= $ticket['qty']; $i++)
												{	 
													?>
													<dl class="dl-horizontal">
														<dt><?php __('front_name');?> #<?php echo $i;?>: </dt>
														<dd><?php echo isset($FORM['attendee'][$ticket['id']][$i]) ? $FORM['attendee'][$ticket['id']][$i] : NULL;?></dd>
													</dl><!-- /.dl-horizontal -->
													<?php
												} 
												?>
											</div><!-- /.form-horizontal -->
										</section><!-- /.pjTbFormSection -->
										<?php
									}
								}
							} 
							?>
							
							<section class="pjTbFormSection">
								<p class="pjTbFormSectionTitle"><?php __('front_ticket_buyer');?></p><!-- /.pjTbFormSectionTitle -->
	
								<div class="form-horizontal">
									<?php
									if (in_array((int) $tpl['option_arr']['o_bf_include_title'], array(2,3)))
									{ 
										$personal_titles = __('personal_titles', true);
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_title'); ?>: </dt>
											<dd><?php echo $personal_titles[$FORM['c_title']];?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_name'], array(2,3)))
									{ 
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_name'); ?>: </dt>
											<dd><?php echo pjSanitize::html(@$FORM['c_name']); ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_email'], array(2,3)))
									{
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_email'); ?>: </dt>
											<dd><?php echo pjSanitize::html(@$FORM['c_email']); ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_phone'], array(2,3)))
									{
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_phone'); ?>: </dt>
											<dd><?php echo pjSanitize::html(@$FORM['c_phone']); ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_company'], array(2,3)))
									{
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_company'); ?>: </dt>
											<dd><?php echo pjSanitize::html(@$FORM['c_company']); ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_address'], array(2,3)))
									{
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_address'); ?>: </dt>
											<dd><?php echo pjSanitize::html(@$FORM['c_address']); ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_country'], array(2,3)))
									{
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_country'); ?>: </dt>
											<?php
											if(isset($tpl['country_arr']['country_title']))
											{ 
												?><dd><?php echo pjSanitize::html($tpl['country_arr']['country_title']); ?></dd><?php
											}else{
												?><dd>&nbsp;</dd><?php
											} 
											?>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_state'], array(2,3)))
									{
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_state'); ?>: </dt>
											<dd><?php echo pjSanitize::html(@$FORM['c_state']); ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_city'], array(2,3)))
									{
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_city'); ?>: </dt>
											<dd><?php echo pjSanitize::html(@$FORM['c_city']); ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_zip'], array(2,3)))
									{
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_zip'); ?>: </dt>
											<dd><?php echo pjSanitize::html(@$FORM['c_zip']); ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									}
									if (in_array((int) $tpl['option_arr']['o_bf_include_notes'], array(2,3)))
									{
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_notes'); ?>: </dt>
											<dd><?php echo pjSanitize::html(@$FORM['c_notes']); ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
									} 
									if ($tpl['option_arr']['o_payment_disable'] == 'No')
									{
										$payment_methods = __('payment_methods', true);
										$cc_types = __('cc_types', true);
										?>
										<dl class="dl-horizontal">
											<dt><?php __('front_payment_method'); ?>: </dt>
											<dd><?php echo $payment_methods[$FORM['payment_method']]; ?></dd>
										</dl><!-- /.dl-horizontal -->
										<?php
										if(@$FORM['payment_method'] == 'bank')
										{
											?>
											<dl class="dl-horizontal">
												<dt><?php __('front_bank_account'); ?>: </dt>
												<dd><?php echo nl2br(pjSanitize::html($tpl['option_arr']['o_bank_account'])); ?></dd>
											</dl><!-- /.dl-horizontal -->
											<?php
										}
										if(@$FORM['payment_method'] == 'creditcard')
										{
											?>
											<dl class="dl-horizontal">
												<dt><?php __('front_cc_type'); ?>: </dt>
												<dd><?php echo $cc_types[$FORM['cc_type']]; ?></dd>
											</dl><!-- /.dl-horizontal -->
											<dl class="dl-horizontal">
												<dt><?php __('front_cc_num'); ?>: </dt>
												<dd><?php echo pjSanitize::html(@$FORM['cc_num']); ?></dd>
											</dl><!-- /.dl-horizontal -->
											<dl class="dl-horizontal">
												<dt><?php __('front_cc_code'); ?>: </dt>
												<dd><?php echo pjSanitize::html(@$FORM['cc_code']); ?></dd>
											</dl><!-- /.dl-horizontal -->
											<dl class="dl-horizontal">
												<dt><?php __('front_cc_exp'); ?>: </dt>
												<dd><?php echo pjSanitize::html(@$FORM['cc_exp_month']); ?>/<?php echo pjSanitize::html(@$FORM['cc_exp_year']); ?></dd>
											</dl><!-- /.dl-horizontal -->
											<?php
										}
									}
									?>
								</div><!-- /.form-horizontal -->
							</section><!-- /.pjTbFormSection -->
						</div><!-- /.pjTbForm pjTbFormCheckout -->
					</section><!-- /.pjTbSectionCheckout -->
				</div><!-- /.panel-body pjTbBody -->
				
				<div class="panel-body pjTbBody" style="display: none;"><p class="text-danger" id="pjEtsSummaryMsg_<?php echo $_GET['id']; ?>"></p></div>
				
				<footer class="panel-footer clearfix pjTbFooter">
					<a href="#" class="btn btn-default pull-left pjEtsMenuItem" data-load="loadCheckout"><?php __('front_btn_back');?></a>
					<button type="submit" class="btn btn-primary pull-right"><?php __('front_btn_submit');?></button>
				</footer><!-- /.panel-footer clearfix pjTbFooter -->
			</form>
		</div><!-- /.panel panel-default pjTbMain -->
		<?php
	}else{
		?>
		<div class="panel panel-default pjTbMain">
			<div class="panel-body pjTbBody">
				<?php __('front_event_not_available');?>
			</div>
		</div>
		<?php
	}
}else{
	?>
	<div class="panel panel-default pjTbMain">
		<div class="panel-body pjTbBody">
			<?php __('front_event_not_exist');?>
		</div>
	</div>
	<?php
}
?>