<form action="" method="post" class="pj-form form">
	<input type="hidden" name="item_add" value="1" />
	<input type="hidden" name="csrf_token" value="<?php echo pjAppController::getCsrfToken(); ?>" />
	<input type="hidden" name="booking_id" value="<?php echo @$_GET['id']; ?>" />
	<input type="hidden" name="hash" value="<?php echo @$_GET['hash']; ?>" />
	<input type="hidden" name="date_from" value="<?php echo pjSanitize::html($_GET['date_from']); ?>" />
	<input type="hidden" name="date_to" value="<?php echo pjSanitize::html($_GET['date_to']); ?>" />
	<input type="hidden" name="hour_from" value="<?php echo pjSanitize::html($_GET['hour_from']); ?>" />
	<input type="hidden" name="hour_to" value="<?php echo pjSanitize::html($_GET['hour_to']); ?>" />
	<input type="hidden" name="minute_from" value="<?php echo pjSanitize::html($_GET['minute_from']); ?>" />
	<input type="hidden" name="minute_to" value="<?php echo pjSanitize::html($_GET['minute_to']); ?>" />
	<div class="b10 p">
		<label class="title"><?php __('booking_i_name'); ?></label>
		<select name="foreign_id" class="pj-form-field w300 stock-product">
			<option value=""><?php __('booking_i_select'); ?></option>
			<optgroup label="<?php __('booking_i_equipment', false, true); ?>">
			<?php
			foreach ($tpl['item_arr'] as $item)
			{
				$max_cnt = pjUtil::getMaxCount($item['cnt'], $item['min_from'], $item['min_to']);
				
				if ((int) $max_cnt > 0 && (int) $max_cnt > (int) $item['booked_qty'])
				{
					?><option value="<?php echo $item['type']; ?>_<?php echo $item['id']; ?>" data-qty="<?php echo (int) $max_cnt - (int) $item['booked_qty']; ?>"><?php echo pjSanitize::html($item['title']); ?></option><?php
				}
			}
			?>
			</optgroup>
			<optgroup label="<?php __('booking_i_packages', false, true); ?>">
			<?php
			foreach ($tpl['package_arr'] as $item)
			{
				$max_cnt = pjUtil::getMaxCount($item['cnt'], $item['min_from'], $item['min_to']);
				
				if ((int) $max_cnt > 0 && (int) $max_cnt > (int) $item['booked_qty'])
				{
					?><option value="<?php echo $item['type']; ?>_<?php echo $item['id']; ?>" data-qty="<?php echo (int) $max_cnt - (int) $item['booked_qty']; ?>"><?php echo pjSanitize::html($item['title']); ?></option><?php
				}
			}
			?>
			</optgroup>
		</select>
	</div>
	
	<div class="item_details" style="display: none">
		<p>
			<label class="title"><?php __('booking_i_qty'); ?></label>
			<input type="text" name="qty" class="pj-form-field w80" data-max="" value="1" readonly="readonly" />
		</p>
	</div>
</form>