<style>
    .voucherlbl{
        padding-left: 0px !important;
    }
    
</style>
<?php 
$rental_hours = $_SESSION[$controller->default_product][$controller->default_order]['rental_hours'];
$hours = $rental_hours %24;
if($tpl['option_arr']['o_booking_periods'] == 'perday')
{
    $days = $_SESSION[$controller->default_product][$controller->default_order]['rental_days'];
}else{
	$days = 0;
	if($hours == 0 )
	{
		$days = $rental_hours / 24;
	}else {
		$days = floor($rental_hours / 24);
	}
} 
?>

<div class="panel panel-default">
	<div class="panel-heading">
		<h1 class="panel-title"><?php __('front_3_payment'); ?></h1><!-- /.panel-title -->
	</div><!-- /.panel-heading -->
	<?php
	$rental_fee_detail = array();
	?>
	<div class="panel-body">
		<div class="table-responsive">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
				<tr>
					<td class="col-xs-12" colspan="2">
						<div class="form-group">
            				<label class="col-sm-4 control-label voucherlbl"><?php __('front_voucher_code');?></label><!-- /.col-sm-4 -->
            
            				<div class="col-sm-8">
            					<div class="row form-group">
            						<div class="col-sm-6">
            							<input type="text" id="pjCrVoucherCodeField" name="voucher_code" value="<?php echo isset($STORAGE['voucher_code']) ? pjSanitize::html($STORAGE['voucher_code']) : NULL; ?>" class="form-control">
            						</div>	
            						<div class="col-sm-6">
            							<a href="#" class="btn btn-primary pull-left pjCrBtn pjCrBtntDefault pjCrApplyCode" style="display:<?php echo $voucher_valid == false ? '' : 'none';?>;"><?php echo __('front_btn_apply', false, true); ?></a>
            							<a href="#" class="btn btn-primary pull-left pjCrBtn pjCrBtntDefault pjCrRemoveCode" style="display:<?php echo $voucher_valid == false ? 'none' : '';?>;"><?php echo __('front_btn_remove', false, true); ?></a>
            						</div>	
            					</div>
            					<div id="pjCrVoucherMessage" class="alert<?php echo $voucher_valid == false ? '' : ' alert-info';?>" style="display:<?php echo $voucher_valid == false ? ' none' : '';?>;"><?php echo $voucher_msg;?></div>
            				</div><!-- /.col-sm-8 -->
            			</div><!-- /.row -->
					</td>
				</tr>
				
				<tr>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
						<strong><?php __('front_3_rental_duration'); ?></strong>
					</td>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right">
						<?php
						if($tpl['cart']['day_added'] == 1)
						{
							$days++;
							echo $rental_duration = $days > 0 ? ($days == 1 ? $days ." ". __('front_label_day',true) : $days ." ". __('front_3_days',true) ) : '';
						}else{
							echo $rental_duration = $days > 0 ? ($days == 1 ? $days ." ". __('front_label_day',true) : $days ." ". __('front_3_days',true) ) : ''?><?php echo $days > 0 && $hours > 0 ? ' ' :'';?><?php echo $hours > 0 ?  $hours." ".__('front_3_hours',true) : '';
						}
						?>
					</td>
				</tr>
				<tr style="display:<?php echo in_array($tpl['option_arr']['o_booking_periods'], array('both', 'perday')) ? 'table-row' : 'none';?>">
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5"><strong><?php __('front_3_price_per_day'); ?></strong><br/><?php echo $tpl['cart']['price_per_day_detail']; ?></td>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right">
						<?php echo $rental_fee_detail[] = pjCurrency::formatPrice($tpl['cart']['price_per_day']);?>
					</td>
				</tr>
				<tr style="display:<?php echo in_array($tpl['option_arr']['o_booking_periods'], array('both', 'perhour')) ? 'table-row' : 'none';?>">
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5"><strong><?php __('front_3_price_per_hour'); ?></strong><br/><?php echo $tpl['cart']['price_per_hour_detail']; ?></td>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right">
						<?php echo $rental_fee_detail[] = pjCurrency::formatPrice($tpl['cart']['price_per_hour']);?>
					</td>
				</tr>
				<tr>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
						<strong><?php __('front_3_price'); ?></strong><br/><?php echo join(" + ", $rental_fee_detail);?><br/><?php __('lblIncludeKm'); ?> <?php echo $tpl['cart']['total_kilometers'];?><br/><?php __('lblAdditionalKmPrice'); ?> <?php echo pjCurrency::formatPrice($tpl['type_arr']['extra_price']);?>
					</td>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right"><?php echo pjCurrency::formatPrice($tpl['cart']['car_rental_fee']);?></td>
				</tr>

				<tr>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
						<strong><?php __('front_3_extra_price'); ?></strong>
					</td>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right"><?php echo pjCurrency::formatPrice($tpl['cart']['extra_price']);?></td>
				</tr>
				<?php
				if ($tpl['option_arr']['o_insurance_payment'] > 0)
				{
					$insurance_types = __('insurance_type_arr', true, false);
					?>
					<tr>
						<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5"><strong><?php __('front_3_insurance'); ?></strong><br/>
							<?php
							switch ($tpl['option_arr']['o_insurance_payment_type']) {
								case 'perday':
									echo pjCurrency::formatPrice($tpl['option_arr']['o_insurance_payment']) . ' ' . strtolower($insurance_types['perday']);
								;
								break;
								case 'percent':
									echo $tpl['option_arr']['o_insurance_payment'] . '% ' . __('front_label_of', true, false) . ' ' . pjCurrency::formatPrice($tpl['cart']['price']);
								;
								break;
								case 'perbooking':
									echo pjCurrency::formatPrice($tpl['option_arr']['o_insurance_payment']) . ' ' . strtolower($insurance_types['perbooking']);
								;
								break;
							}
							?>
						</td>
						<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right">
							<?php echo pjCurrency::formatPrice($tpl['cart']['insurance']);?>
						</td>
					</tr>
					<?php
				} 
				?>
				<tr>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
						<strong><?php __('front_3_sub_total'); ?></strong>
					</td>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right"><?php echo pjCurrency::formatPrice($tpl['cart']['sub_total']);?></td>
				</tr>
				<?php if (isset($tpl['cart']['booking_discount']) && (float)$tpl['cart']['booking_discount'] > 0) {?>
					<tr>
    					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
    						<strong><?php __('front_summary_discount'); ?></strong>
    					</td>
    					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right"><?php echo pjCurrency::formatPrice($tpl['cart']['booking_discount']);?></td>
    				</tr>
				<?php } ?>
				<?php
				if ($tpl['option_arr']['o_tax_payment'] > 0)
				{
					?>
					<tr>
						<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5"><strong><?php __('front_3_tax'); ?></strong><br/>
							<?php
							if($tpl['option_arr']['o_tax_type'] == 'percent')
							{
							    echo $tpl['option_arr']['o_tax_payment'] . '% ' . __('front_label_of', true, false) . ' ' . pjCurrency::formatPrice((float)$tpl['cart']['sub_total'] - (float)$tpl['cart']['booking_discount']);
							}
							?>
						</td>
						<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right">
							<?php echo pjCurrency::formatPrice($tpl['cart']['tax']);?>
						</td>
					</tr>
					<?php
				}
				?>
				<tr>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
						<strong class="text-danger pjCrColorPrimary"><?php __('front_3_total_price'); ?></strong>
					</td>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right"><?php echo pjCurrency::formatPrice($tpl['cart']['total_price']);?></td>
				</tr>
				<?php
				if ($tpl['option_arr']['o_security_payment'] > 0)
				{
					?>
					<tr>
						<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
							<strong><?php __('front_3_security_deposit'); ?></strong>
						</td>
						<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right">
							<?php echo pjCurrency::formatPrice($tpl['option_arr']['o_security_payment']);?>
						</td>
					</tr>
					<?php
				} 
				?>
				<tr>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
						<strong><?php __('front_3_required_deposit'); ?></strong>
						<br />
						<?php
						switch ($tpl['option_arr']['o_deposit_type'])
						{
							case 'percent':
								echo $tpl['option_arr']['o_deposit_payment'] . '% ' . __('front_label_of', true, false) . ' ' . pjCurrency::formatPrice($tpl['cart']['total_price']);
								break;
							case 'amount':
								break;
						}
						?>
					</td>
					<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right"><?php echo pjCurrency::formatPrice($tpl['cart']['required_deposit']);?></td>
				</tr>
			</table><!-- /.table -->
		</div><!-- /.table-responsive -->
	</div><!-- /.panel-body -->
</div><!-- /.panel panel-default -->