<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($tpl['avail_items_in_package'] > 0)
				{
					foreach (range(1, $tpl['avail_items_in_package']) as $i)
					{
						?><option value="<?php echo $i; ?>"<?php echo $i != $_POST['cnt'] ? NULL : ' selected="selected"'; ?>><?php echo $i; ?></option><?php
					}
				}else{
					?><option value=""><?php __('equipment_na');?></option><?php
				}
				?>
			</select>
		</dd>
	</dl><!-- /.dl-horizontal -->
	<?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(); ?>#!/Package/<?php echo (int) $_POST['package_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'] &&
			$tpl['avail_items_in_package'] > 0)
	{
		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="package" />
			<input type="hidden" name="id" value="<?php echo (int) $_POST['package_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(); ?>#!/Packages" class="btn btn-default btn-block pjErBtn pjErBtnSecondary erSelectorPackages erBack"><?php __('button_back'); ?></a>
			</div><!-- /.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-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(); ?>#!/Packages" class="btn btn-default btn-block pjErBtn pjErBtnSecondary erSelectorPackages erBack"><?php __('button_back'); ?></a>
			</div><!-- /.col-md-4 col-sm-6 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-md-4 col-sm-6 col-xs-12 -->
		</div><!-- /.form-group pjErFormActions -->
		<?php
		if (isset($tpl['other_arr']) && !empty($tpl['other_arr']))
		{
			
		}
	} 
	?>
</form><!-- /.form-horizontal pjErForm pjErFormAvailability -->