<form action="" method="post" class="form-horizontal pjErForm pjErFormAvailability erSelectorBuyNowForm">
	<dl class="dl-horizontal">
		<dt class="pjErLabel"><?php __('number_items'); ?></dt>
		<dd>
			<select name="qty" class="form-control erFormField pjErQtySelector">
				<?php
				$max_cnt = pjUtil::getMaxCount($tpl['arr']['cnt'], $tpl['arr']['min_from'], $tpl['arr']['min_to']);
				$_max_cnt = $max_cnt - (int) $tpl['arr']['booked_qty'];
				if($_max_cnt > 0)
				{
					foreach (range(1, $_max_cnt) as $i)
					{
						?><option value="<?php echo $i; ?>"<?php echo $i != $_POST['cnt'] ? NULL : ' selected="selected"'; ?>><?php echo $i; ?></option><?php
					}
				}
				?>
			</select>
		</dd>
	</dl><!-- /.dl-horizontal -->
	<div style="clear: both;"></div>
	<?php
	$date_from_ts = strtotime(pjUtil::formatDate($_POST['date_from'], $tpl['option_arr']['o_date_format']) . ' ' . $_POST['hour_from'] . ':' . $_POST['minute_from']); 
	$date_to_ts = strtotime(pjUtil::formatDate($_POST['date_to'], $tpl['option_arr']['o_date_format']) . ' ' . $_POST['hour_to'] . ':' . $_POST['minute_to']);
	?>
	<dl class="dl-horizontal">
		<dt><?php __('rental_start'); ?></dt>
		<dd><?php echo date( $tpl['option_arr']['o_date_format'] . ', ' .  $tpl['option_arr']['o_time_format'], $date_from_ts); ?> <a href="<?php echo pjUtil::getReferer(); ?>#!/Item/<?php echo (int) $_POST['item_id']; ?>" class="btn btn-link pjErBtn pjErBtnLink erSelectorChangeDates"><?php __('change_dates'); ?></a></dd>
	</dl><!-- /.dl-horizontal -->

	<dl class="dl-horizontal">
		<dt><?php __('rental_end'); ?></dt>
		<dd><?php echo date( $tpl['option_arr']['o_date_format'] . ', ' .  $tpl['option_arr']['o_time_format'], $date_to_ts); ?> </dd>
	</dl><!-- /.dl-horizontal -->
	<?php
	if (isset($tpl['arr']) &&
			isset($tpl['price']) &&
			(int) $max_cnt > 0 &&
			(int) $max_cnt >= (int) $tpl['arr']['booked_qty'] + (int) $_POST['cnt'])
	{
		if($tpl['option_arr']['o_disable_payments'] == 0 || $tpl['option_arr']['o_hide_prices'] == 0)
		{
			?>
			<dl class="dl-horizontal">
				<dt><?php __('total_price'); ?></dt>
				<dd id="pjErTotalPriceLabel"><?php echo pjUtil::formatCurrencySign(number_format($tpl['price'] * (int) $_POST['cnt'], 2), $tpl['option_arr']['o_currency']); ?></dd>
			</dl><!-- /.dl-horizontal -->
			<?php
		}
		?>
		<div class="form-group pjErFormActions">
			<input type="hidden" name="type" value="item" />
			<input type="hidden" name="id" value="<?php echo (int) $_POST['item_id']; ?>" />
			<input type="hidden" name="price" value="<?php echo $tpl['price']; ?>" />
			
			<div class="col-md-4 col-sm-6 col-xs-12">
				<a href="<?php echo pjUtil::getReferer(); ?>#!/Items" class="btn btn-default btn-block pjErBtn pjErBtnSecondary erSelectorItems erBack"><?php __('button_back'); ?></a>
			</div><!-- /.col-lg-4 col-md-4 col-sm-6 col-xs-12 -->
			<?php
			if ((int) $tpl['option_arr']['o_accept_bookings'] === 1)
			{
				?>
				<div class="col-md-4 col-sm-6 col-xs-12">
					<button type="submit" class="btn btn-default btn-block pjErBtn pjErBtnPrimary"><?php __('button_checkout'); ?></button>
				</div><!-- /.col-lg-4 col-md-4 col-sm-6 col-xs-12 -->
				<?php
			} 
			?>
		</div><!-- /.form-group pjErFormActions -->
		<?php
	} else {
		?>
		<div class="form-group pjErFormActions">
			<div class="col-md-4 col-sm-5 col-xs-12">
				<a href="<?php echo pjUtil::getReferer(); ?>#!/Items" class="btn btn-default btn-block pjErBtn pjErBtnSecondary erSelectorItems erBack"><?php __('button_back'); ?></a>
			</div><!-- /.col-lg-4 col-md-4 col-sm-5 col-xs-12 -->
	
			<div class="col-md-6 col-sm-7 col-xs-12">
				<button type="button" class="btn btn-default btn-block pjErBtn pjErBtnPrimary" disabled="disabled"><?php __('not_available'); ?></button>
			</div><!-- /.col-lg-6 col-md-6 col-sm-7 col-xs-12 -->
		</div><!-- /.form-group pjErFormActions -->
		<?php
		if (isset($tpl['other_arr']) && !empty($tpl['other_arr']))
		{
			
		}
	} 
	?>
</form><!-- /.form-horizontal pjErForm pjErFormAvailability -->