<?php
if (isset($tpl['status']) && $tpl['status'] == "OK")
{
	?>
	<script src="https://js.stripe.com/v3/"></script>
	<div class="panel-heading pjAsHead">
		<div class="row">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="alert alert-warning" role="alert">
					<?php
					$status = __('front_booking_status', true);
					
					if (isset($tpl['booking_arr']))
					{
						switch ($tpl['booking_arr']['payment_method'])
						{
							case 'paypal':
								switch ($tpl['booking_arr']['booking_status'])
								{
									case 'pending':
								
										echo $status[11];
										?>
										<div class="asElementOutline"><?php
										if (pjObject::getPlugin('pjPaypal') !== NULL)
										{
											$controller->requestAction(array('controller' => 'pjPaypal', 'action' => 'pjActionForm', 'params' => $tpl['params']));
										}
										?></div><?php
										break;
									case 'cancelled':
										echo $status[5];
										break;
									default:
										echo $status[3];
										break;
								}
								break;
								case 'stripe':
									switch ($tpl['booking_arr']['booking_status'])
									{
										case 'pending':
									
											echo $status[11];
											?>
											<div class="asElementOutline">
												
												<?php
											if (pjObject::getPlugin('pjStripe') !== NULL)
											{
												
												$controller->requestAction(array('controller' => 'pjStripe', 'action' => 'pjActionForm', 'params' => $tpl['params']));
											}
											?></div><?php
											break;
										case 'cancelled':
											echo $status[5];
											break;
										default:
											echo $status[3];
											break;
									}
									break;
							case 'authorize':
								switch ($tpl['booking_arr']['booking_status'])
								{
									case 'pending':
										echo $status[11];
										?>
										<div class="asElementOutline"><?php
										if (pjObject::getPlugin('pjAuthorize') !== NULL)
										{
											$controller->requestAction(array('controller' => 'pjAuthorize', 'action' => 'pjActionForm', 'params' => $tpl['params']));
										}
										?></div><?php
										break;
									case 'cancelled':
										echo $status[5];
										break;
									default:
										echo $status[3];
										break;
								}
								break;
                            case 'three_step_redirect':
                                switch ($tpl['booking_arr']['booking_status'])
                                {
                                    case 'pending':
                                        echo $status[11];
                                        ?>
										<div class="asElementOutline">
											<form id="<?php echo $tpl['params']['id'];?>" name="<?php echo $tpl['params']['name'];?>" action="<?php echo $tpl['params']['formURL'];?>" method="POST">
												<input type ="hidden" name="billing-cc-number" value="<?php echo $tpl['booking_arr']['cc_num'];?>"/>
												<input type ="hidden" name="billing-cc-exp" value="<?php echo $tpl['booking_arr']['cc_exp_month'];?><?php echo substr( $tpl['booking_arr']['cc_exp_year'], -2);?>">
												<input type ="hidden" name="cvv" value="<?php echo $tpl['booking_arr']['cc_code'];?>">
											</form>
										</div><?php
										break;
									case 'cancelled':
										echo $status[5];
										break;
									default:
										echo $status[3];
										break;
								}
                                break;
                            case 'redsys':
                            	switch ($tpl['booking_arr']['booking_status'])
                                {
                                    case 'pending':
                                        echo $status[11];
                                        ?>
										<div class="asElementOutline">
											<form name="<?php echo $tpl['params']['id'];?>" id="<?php echo $tpl['params']['name'];?>" method="POST" action="<?php echo PJ_TEST_MODE ? 'https://sis-t.redsys.es:25443/sis/realizarPago' : 'https://sis.redsys.es/sis/realizarPago';?>" target="<?php echo $tpl['params']['target']; ?>">
												<input type="hidden" name="Ds_SignatureVersion" value="HMAC_SHA256_V1" />
												<input type="hidden" name="Ds_MerchantParameters" value="<?php echo $tpl['params']['marchant_params'];?>" />
												<input type="hidden" name="Ds_Signature" value="<?php echo $tpl['params']['marchant_signature'];?>" />
											</form>
										</div><?php
										break;
									case 'cancelled':
										echo $status[5];
										break;
									default:
										echo $status[3];
										break;
								}
								break;
							case 'bank':
								echo $status[1] . '<br/>' .  pjSanitize::html(nl2br($tpl['option_arr']['o_bank_account']));
								?><br/><a href="#" class="alert-link pjAsBtnBackToServices"><?php __('front_start_over');?></a><?php 
								break;
							case 'creditcard':
							case 'none':
							default:
								echo $status[1];
								?><br/><a href="#" class="alert-link pjAsBtnBackToServices"><?php __('front_start_over');?></a><?php
						}
					} else {
						echo $status[4];
					}
					?>
				</div>
			</div><!-- /.col-lg-12 col-md-12 col-sm-12 col-xs-12 -->
		</div>
	</div>
	<?php
} elseif (isset($tpl['status']) && $tpl['status'] == 'ERR') {
	?>
	<div class="panel-heading pjAsHead">
		<div class="row">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="alert alert-warning" role="alert">
				  	<?php __('front_system_msg'); ?><br/><?php __('front_checkout_na'); ?><br/><a href="#" class="alert-link pjAsBtnBackToServices"><?php __('front_return_back');?></a>
				</div>
			</div><!-- /.col-lg-12 col-md-12 col-sm-12 col-xs-12 -->
		</div><!-- /.row -->
	</div><!-- /.panel-heading pjAsHead -->
	<?php
}
?>