<div class="entry-table-head">
	<div class="pull-right text-right">
		<h5>
			<?php
			$week_arr = pjUtil::getWeeksOfMonth(date('Y', $_GET['month']), date('n', $_GET['month']), $tpl['option_arr']['o_week_start']);
			$months = __('months', true); 
			?>
		</h5>
	</div><!-- /.pull-right -->
	
	<div class="pull-left">
		<a href="#" class="btn btn-primary ylNavMonth" data-id="<?php echo $_GET['id']?>" data-month="<?php echo $week_arr['prev'] ?>"><span class="glyphicon glyphicon-menu-left"></span> <?php __('ws_prev');?></a>
		<a href="#" class="btn btn-primary ylNavMonth" data-id="<?php echo $_GET['id']?>" data-month="<?php echo $week_arr['next'] ?>"><?php __('ws_next');?> <span class="glyphicon glyphicon-menu-right"></span></a>
	</div><!-- /.pull-left -->
</div><!-- /.entry-table-head -->

<div class="entry-table-body">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<?php
		foreach($week_arr as $k => $v)
		{
			if($k == 'next' || $k == 'prev')
			{
				continue;
			}
			$iso_date = date('Y-m-d', $v['monday']);
			$is_reserved = false;
			$is_avaialble = false;
			if(in_array($iso_date, $tpl['booking_arr']))
			{
				$is_reserved = true;
			}else{
				if(isset($tpl['price_arr'][$iso_date]))
				{
					if($iso_date >= date('Y-m-d'))
					{
						$is_avaialble = true;
					}
				}
			}
			?>
			<tr class="<?php echo $is_reserved == true ? 'ylReserved' : ($is_avaialble == true ? 'ylAvailable' : 'ylUnavailable');?>">
				<td><?php __('ws_week')?> <?php echo $k;?></td>
				<td><?php echo date($tpl['option_arr']['o_date_format'], $v['monday'])?> - <?php echo date($tpl['option_arr']['o_date_format'], $v['sunday'])?></td>
				
				<td>
					<strong><?php echo $is_avaialble == true ? pjUtil::formatCurrencySign($tpl['price_arr'][$iso_date], $tpl['option_arr']['o_currency'])  : '&nbsp;'?></strong>
				</td>
				<td>
					<?php
					if($is_reserved == false)
					{ 
						if($is_avaialble == true)
						{
							?>
							<strong class="free"><?php __('ws_free');?></strong>
							<?php
						}else{
							?><strong class="not-available"><?php __('ws_not_avaialble');?></strong><?php
						}
					}else{
						?><strong class="reserved"><?php __('ws_reserved');?></strong><?php
					} 
					?>
				</td>
				<td>
					<?php
					if($is_reserved == false)
					{ 
						if($is_avaialble == true)
						{
							?>
							<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjListings&amp;action=pjActionReserve&amp;id=<?php echo $_GET['id']?>" data-week="<?php echo $v['monday'];?>" class="btn btn-primary btn-sm ylBtnReserve"><?php __('ws_make_a_reservation');?></a>
							<?php
						}else{
							?>&nbsp;<?php
						}
					}else{
						?>&nbsp;<?php
					} 
					?>
				</td>
			</tr>

			<?php
		} 
		?>
	</table>
</div><!-- /.entry-table-body -->