<?php
defined( '_JEXEC' ) or die('Restricted access' );

$bookingType = $this->data['fab_bookings___booking_type_raw'][0];
$totalNightNum = 0;

$hotels = array('davidcitadel', 'carmelforest', 'carlton', 'deadsea', 'royalbeach'); 
$hotelDetails = array(
				'davidcitadel' => array(
								'name' =>'The David Citadel Hotel' ,
								'address' => '7, Hamelech David St., Jerusalem',
								'phone' => '+972-2-621-1111',
								'fax' => '+972-2-621-1000',
								'email' => 'rsinai@tdchotel.com'),
				'carmelforest' => array(
								'name' => 'Carmel Forest Spa Resort',
								'address' => 'Carmel Park, Haifa',
								'phone' => '+972-4-820-7888',
								'fax' => '+972-4-832-3988',
								'email' => 'meitalb@isrotel.co.il'),
				'carlton' => array(
								'name' => 'Carlton Tel Aviv Hotel',
								'address' => '10, Eliezer Perry St., Tel Aviv',
								'phone' => '+972-3-520-1818',
								'fax' => '+972-3-527-1043',
								'email' => 'avital@carlton.co.il'),
				'deadsea' => array(
								'name' => 'Isrotel Dead Sea Resort & Spa',
								'address' => 'Ein Bokek, Dead Sea',
								'phone' => '+972-8-668-9666',
								'fax' => '+972-8-652-0301',
								'email' => 'meitalb@isrotel.co.il'),
				'royalbeach' => array(
								'name' => 'Royal Beach Eilat Hotel',
								'address' => 'North Beach, Eilat',
								'phone' => '+972-8-636-8888',
								'fax' => '+972-8-636-8811',
								'email' => 'meitalb@isrotel.co.il'));
?>

<html>
<body>

<div style="font: 12px Arial, Helvetica, sans-serif; color: #003D60">

	<div style="font-size: 26px;"><b>Booking Confirmation</b></div>
	<br /><br />
	<div style="font-size: 14px;"><b>Thank you for booking at <i><span style="color:#0075be;">Choose to Have It All!</span></i></b></div>
	<br />
	<div style="font-size: 14px;"><b>Your booking has been confirmed:</b></div>
	<br />
	
	<table style="border:0; width:525px; font: 14px Arial, Helvetica, sans-serif; color: #003D60;" cellpadding="0" cellspacing="0">
		<tr>
			<td style="width:125px; height: 24px;"><b>Booking number:</b></td>
			<td style="width:400px"><b><?php echo $this->data['rowid'];?></b></td>
		</tr>
		<tr>
			<td style="height: 24px;">Guest Name:</td>
			<td><b><?php echo $this->data['fab_bookings___first_name'] . ' ' . $this->data['fab_bookings___family_name'];?></b></td>
		</tr>
		<tr>
			<td style="height: 24px;">Email:</td>
			<td>
			<?php
				echo $this->data['fab_bookings___email'];
				if ($bookingType == 2) echo ' (agency)';
			?>				
			</td>
		</tr>
	</table>
	<br />
	
	<div style="font-size: 14px;"><b><u>Booking details:</u></b></div><br />
	<table style="border: 1px solid #0075be;width: 660px; font: 14px Arial, Helvetica, sans-serif; color: #003D60; border-collapse: collapse;" cellpadding="3" cellspacing="0">
		<tr>
			<td align="left" style="width: 200px; height: 24px; border: 1px solid #0075be;">
				<b>Adults: &nbsp;&nbsp;<?php echo $this->data['fab_bookings___adults_number'];?></b>
			</td>
			<td align="left" style="width: 200px; border: 1px solid #0075be;">
				<b>Children: &nbsp;&nbsp;<?php echo $this->data['fab_bookings___children_number'];?></b>
			</td>
			<td align="left" style="width: 260px; border: 1px solid #0075be;">
				<b>No. of Rooms: &nbsp;&nbsp;<?php echo $this->data['fab_bookings___rooms_number'];?></b>
			</td>
		</tr>
		<tr>
			<td colspan="3" style="height: 24px;">&nbsp;</td>
		</tr>

		<?php  // booking dates joined-data repeated-group (specific join code)
			$datesJoin = (array)$this->data['join'][49];
			$keys = array_keys($datesJoin);
			
			$length = count($datesJoin[$keys[0]]);
			for($i = 0; $i < $length; $i++) {
				$thisHotel = $hotels[$this->data['fab_bookings_dates___hotel_id_raw'][$i]-1];
				$totalNightNum += $datesJoin['fab_bookings_dates___nights_number'][$i];
		?>
					<tr>
						<td colspan="2" align="left" style="height: 24px; border: 1px solid #0075be;">
							Hotel: <b><?php echo $hotelDetails[$thisHotel]['name'];?></b>
						</td>
						<td align="left" style="border: 1px solid #0075be;">
							Reference number: &nbsp;&nbsp;<b><?php $this->data['fab_bookings_dates___id_raw'][$i];?></b>
						</td>
					</tr>
					<tr>
						<td colspan="3" align="left" style="border: 1px solid #0075be;">
							Address: &nbsp;&nbsp;<?php echo $hotelDetails[$thisHotel]['address'];?>
						</td>
					</tr>
					<tr>
						<td colspan="3" style="height: 24px;">Customer service:</td>
					</tr>
					<tr>
						<td align="left" style="height: 24px; border: 1px solid #0075be;">
							Phone: <?php echo $hotelDetails[$thisHotel]['phone'];?>
						</td>
						<td align="left" style="border: 1px solid #0075be;">
							Fax: <?php echo $hotelDetails[$thisHotel]['fax'];?>
						</td>
						<td align="left" style="border: 1px solid #0075be;">
							Email: <?php echo $hotelDetails[$thisHotel]['email'];?>
						</td>
					</tr>
					<tr>
						<td align="left" style="height: 24px; border: 1px solid #0075be;">
							Check-in: &nbsp;&nbsp;<b><?php echo $this->data['fab_bookings_dates___start_date_raw'][$i];?></b>
						</td>
						<td align="left" style="border: 1px solid #0075be;">
							Check-out: &nbsp;&nbsp;<b><?php echo $this->data['fab_bookings_dates___end_date_raw'][$i];?></b>
						</td>
						<td align="left" style="border: 1px solid #0075be;">
							No. of Nights: &nbsp;&nbsp;<?php echo $datesJoin['fab_bookings_dates___nights_number'][$i];?>
						</td>
					</tr>
					<tr>
						<td colspan="3" style="height: 24px;">&nbsp;</td>
					</tr>
		<?php }  // end of booking dates loop ?>
		
		<tr>
			<td colspan="2" align="left" style="height: 24px; border: 1px solid #0075be;">
				<b>Total number of nights: &nbsp;&nbsp;<?php echo $totalNightNum;?></b>
			</td>
			<td align="left" style="border: 1px solid #0075be;">
				<b>Total Price: &nbsp;&nbsp;<?php echo $this->data['fab_bookings___total_price'];?></b>
			</td>
		</tr>
	</table>
	<br />

	<div style="font-size: 14px;"><b><u>Payment details:</u></b></div>
	<ul>
		<li>You have now confirmed and guaranteed your booking by credit card.</li>
		<li>The <i><span style="color:#0075be;">Choose to Have it All</span></i> website does not charge your credit card.</li>
		<li>Your credit card is required to guarantee your booking, and will be charged on Check-out of each hotel of your booking.</li>
		<li>The hotels accept the following forms of payment: American Express, Visa, Mastercard, Diners Club.</li>
	</ul>
	<br />

	<div style="font-size: 14px;"><b><u>Plan Policy:</u></b></div>
	<p><a href="http://www.luxury-hotels-israel.com/terms" style="color:#0075be;">View full Terms & Conditions</a></p>
	<ul>
		<li>The prices at the Site are in U.S. dollars.</li>
		<li>Israeli citizens will be charged addtional 16% VAT (except at the Royal Beach Hotel in Eilat).</li>
		<li>Cancellation charges during the package dates:
			<ul>
				<li>Any room reservation may be cancelled with no extra charge up to 48 hours in advance. This does not refer to special offer conditions/restrictions if existing.</li>
				<li>Any cancellation made during the 48 hours prior to arrival will be charged at the price of one night per every reserved room, according to the type of board ordered.</li>
			</ul>
		</li>
		<li>The Hotels check-in time is 14:00 and check-out time is 12:00. Arrival and/or departure before and/or after the aforesaid times are subject to advanced approval of the hotels management and will entail extra charges.</li>
		<li>Infant , anyone under the age of two years. Child , anyone between the ages of 2 and 12 years.</li>
		<li>Carmel Forest Spa Resort, Haifa - For guests over age 16 only.</li>
		<li>Room/Accommodation reservation at the hotel can only be made by an adult over the age of 18.</li>
		<li>Please note that pets are not allowed in the Hotels.</li>
	</ul>
	<br /><br />
	
	<div><b>Thank you, and we look forward to hosting you on your travel in style in Israel!</b></div>
	<br />
	<div style="line-height: 28px;">We thank you for using our services,<br />The <i><span style="color:#0075be;">Choose to Have It All</span></i> team</div><br />
	
</div>

<?php echo "<pre>";print_r($this->data);echo "</pre>"; ?>

</body>
</html>