<?php

include_once dirname(__FILE__) . '/elements/header.php';

$SEARCH = @$_SESSION[$controller->defaultStore]['search'];

$passengers = !empty($SEARCH['passengers']) ? $SEARCH['passengers'] : 0;

$luggage = !empty($SEARCH['luggage']) ? $SEARCH['luggage'] : 0;

$distance = !empty($SEARCH['distance']) ? $SEARCH['distance'] : 0;

$distance = !empty($SEARCH['distance']) ? $SEARCH['distance'] : 0;

$time_str = (int) $SEARCH['luggage'] >= 1 ? __('front_taxi_on', true) : __('front_taxi_on_2', true);

$time_str = str_replace("{DATE}", $SEARCH['booking_date'], $time_str);

$time_str = str_replace("{TIME}", date($tpl['option_arr']['o_time_format'], strtotime($SEARCH['booking_time'])), $time_str);

$time_str = str_replace("{PASSENGERS}", $SEARCH['passengers'], $time_str);

$time_str = str_replace("{LUGGAGES}", $SEARCH['luggage'], $time_str);



$button_color = !empty($tpl['option_arr']['o_change_button_color_ai']) ? $tpl['option_arr']['o_change_button_color_ai'] : '#1ca76c';



?>

<style>

	.button-color-ai{

		background-color: <?php echo $button_color; ?> !important;

		border-color : <?php echo $button_color; ?> !important;

}



[id^=pjWrapper] .container, [id^=pjWrapper] .container-fluid {

    padding-right: 0px !important;

    padding-left: 0px !important;

  

}
.main-div {
    max-width: unset !important;
    padding: 0px 0 !important;
}
</style>



<div class="top-serction">
	<div class="container">
		<div class="row">
<h2>Taxi Reservation</h2>
</div>
</div>
</div>

<div class="pjTbs-body info-sep-to">

	<div class="pjTbs-service-info ">

		<div class="row">

			<div class="col-md-12 col-xs-12">
              <div class="loction">
				<ul>
					<li>Departure Address: <b>Lorem Ipsum</b></li>
					<li>Departure Address: <b>Lorem Ipsum</b></li>
					<li>Departure Address: <b>Lorem Ipsum</b></li>
					<li>Departure Address: <b>Lorem Ipsum</b></li>
					<li>Departure Address: <b>Lorem Ipsum</b></li>
					<li>Departure Address: <b>Lorem Ipsum</b></li>
					<li>Departure Address: <b>Lorem Ipsum</b></li>
					<li>Departure Address: <b>Lorem Ipsum</b></li>


				</ul>
			</div> 
 
            <?php /*
            if (!empty($tpl['fleet_arr'])):
            */ ?>
                <?php /*
                <p><?php __('front_taxi_service_from');?> <strong><?php echo pjSanitize::html($SEARCH['pickup_address']); ?></strong> <?php __('front_to_lowercase');?>
                */ ?>
 
                <?php /*
                if (isset($SEARCH['extra_stop_address']) && is_array($SEARCH['extra_stop_address']) && count($SEARCH['extra_stop_address']) > 0):
                */ ?>
                    <?php /*
                    <strong><?php echo pjSanitize::html(implode(', ', $SEARCH['extra_stop_address'])); ?></strong>
                    */ ?>
                    <?php /*
                    // __('front_to_lowercase');
                    */ ?>
                <?php /*
                endif;
                */ ?>
 
                <?php /*
                __('front_to_lowercase');
                <strong><?php echo pjSanitize::html($SEARCH['return_address']); ?></strong> <?php echo $time_str;?></p>
                */ ?>
 
                <?php /*
                if (isset($SEARCH['return_date']) && is_array($SEARCH['return_date']) && count($SEARCH['return_date']) > 0):
                */ ?>
                    <?php /*
                    <p><?php __('lblReturnDateTime');?> : <?php echo $SEARCH['return_date'];?>, <?php echo date($tpl['option_arr']['o_time_format'], strtotime($SEARCH['return_time']));?></p>
                    */ ?>
                <?php /*
                endif;
                */ ?>
 
            <?php /*
            else:
            */ ?>
                <?php /*
                <p><?php __('lblNoServicesAvailable'); ?></p>
                */ ?>
            <?php /*
            endif;
            */ ?>
 
            </div><!-- /.col-md-10 -->
 
          

		</div><!-- /.row -->

		<input type="hidden" name="o_search_result_redirect" id="o_search_result_redirect_id" value="<?php echo isset($SEARCH['o_search_result_redirect']) ? $SEARCH['o_search_result_redirect'] : ''; ?>" />



		<input type="hidden" name="o_search_result_redirect_en" id="o_search_result_redirect_en_id" value="<?php echo isset($SEARCH['o_search_result_redirect_en']) ? $SEARCH['o_search_result_redirect_en'] : ''; ?>" />





	</div><!-- /.pjTbs-service-info -->



	<?php

	if(!empty($tpl['fleet_arr']))

	{ 

		foreach($tpl['fleet_arr'] as $k => $v)

		{

			$image = PJ_INSTALL_URL . PJ_IMG_PATH . 'frontend/250x130.png';

			if(isset($v['thumb_path']) && !empty($v['thumb_path']) && file_exists(PJ_INSTALL_PATH . $v['thumb_path']))

			{

				$image = PJ_INSTALL_URL . $v['thumb_path'];

			}

			?>

			<div class="pjTbs-car pjTbs-box">

				

		

				<div class="row">

					<div class="col-sm-5 col-xs-12">

						<div class="pjTbs-car-image">

							<img src="<?php echo $image;?>" alt="" class="img-responsive">

						</div><!-- /.pjTbs-car-image -->

					</div><!-- /.col-md-3 -->

		

					<div class="col-sm-7 col-xs-12">

						<div class="pjTbs-car-desc">
                            <div class="pjTbs-car-title"><?php echo pjSanitize::html($v['fleet']);?></div><!-- /.pjTbs-car-title -->
							<ul class="pjTbs-car-meta">

								<li><?php __('front_passengers');?> <?php  //for($p = 1; $p <= (int) $v['passengers']; $p++) {?><!--<span class="glyphicon glyphicon-user"></span>--><?php  // }?><b>4</b> </li>

								<li><?php __('front_bags');?>: <?php // for($p = 1; $p <= (int) $v['luggage']; $p++) {?><!--<span class="glyphicon glyphicon-briefcase"></span>--><?php  // }?><b>4 </b></li>

							</ul><!-- /.pjTbs-car-meta -->		

		

							<div class="pjTbs-car-info"><?php echo nl2br(pjSanitize::clean($v['description']));?></div><!-- /.pjTbs-car-info -->

						</div><!-- /.pjTbs-car-desc -->
						<div class="pjTbs-car-actions">



						<?php

							// $total = $v['start_fee'];

							// if (isset($tpl['fleet_price_arr'][$v['id']]) && (float)$tpl['fleet_price_arr'][$v['id']] > 0) {

							// 	$total += $tpl['fleet_price_arr'][$v['id']];

							// } else {

							// 	$total += $distance * $v['price'];

							// }

							// $total += $passengers * $v['fee_per_person'];

							?>

							

							<?php

									

							//$total = $v['start_fee'];

							// $total += $distance * $v['price'];

							// $total += $passengers * $v['fee_per_person'];

						

							// $total = $v['start_fee'];

							// if (isset($tpl['fleet_price_arr']) && (float)$tpl['fleet_price_arr'] > 0) {

							// 	$value = reset($tpl['fleet_price_arr']);

							// 	$total += $value;

																

							// } else {

							// 	$total += $distance * $v['price'];

							// }

							// $total += $passengers * $v['fee_per_person'];



							$total = $v['start_fee'];

							if (isset($tpl['fleet_price_arr'][$v['id']]) && (float)$tpl['fleet_price_arr'][$v['id']] > 0) {

								$total = $tpl['fleet_price_arr'][$v['id']];

								$total += $tpl['extra_price_arr'][$v['id']];

								if(empty($tpl['extra_price_arr'][$v['id']])){

									$total += $SEARCH['extra_stop_distance'] * $v['price'];

								}

							} else {

								$total += $distance * $v['price'];

								$total += $passengers * $v['fee_per_person'];

							}



								if($SEARCH['return_status'] == 1 ){

									$total = $total*2;

									}

								?>

								<div class="pjTbs-price-holder">

								<div class="pjTbs-price">

									<?php  if (isset($tpl['fleet_price_arr'][$v['id']]) && (float)$tpl['fleet_price_arr'][$v['id']] > 0) { ?> 

										<strong><?php __('front_total');?>: <?php echo pjCurrency::formatPrice($total);?></strong>



										<?php } else { ?>

											<?php __('front_total');?>:

											<strong><?php echo pjCurrency::formatPrice($total); ?></strong>



									<?php } ?>

								</div><!-- /.pjTbs-price -->

							</div><!-- /.pjTbs-price-holder -->

	

							<input type="button" value="<?php __('front_btn_book_a_taxi');?>" data-id="<?php echo $v['id']?>" class="btn btn-primary btn-block pjTbsBtnBookTaxi button-color-ai">

							

						</div><!-- /.pjTbs-car-actions -->	

					

				</div><!-- /.row -->		

					</div><!-- /.col-md-3 -->

					

						

			</div><!-- /.pjTbs-car -->

			<?php

		}

	}

	?>

	<div class="pjTbs-body-actions">

		<br>



		<div class="row">

			<div class="col-sm-12 col-xs-12">
               <div class="botn-back">
				<a href="#" class="btn btn-secondary btn-block pjTbsBtnBack" data-load="loadSearch"><?php __('front_btn_back');?></a>
			</div>

			</div><!-- /.col-sm-3 -->

		</div><!-- /.row -->

	</div><!-- /.pjTbs-body-actions -->

</div><!-- /.pjTbs-body -->