<?php
if (isset($tpl['status']))
{
	$status = __('status', true);
	switch ($tpl['status'])
	{
		case 2:
			pjUtil::printNotice(NULL, $status[2]);
			break;
	}
} else {
	$titles = __('error_titles', true);
	$bodies = __('error_bodies', true);
	if (isset($_GET['err']))
	{
		pjUtil::printNotice(@$titles[$_GET['err']], @$bodies[$_GET['err']]);
	}
	
	$week_start = isset($tpl['option_arr']['o_week_start']) && in_array((int) $tpl['option_arr']['o_week_start'], range(0,6)) ? (int) $tpl['option_arr']['o_week_start'] : 0;
	$jqDateFormat = pjUtil::jqDateFormat($tpl['option_arr']['o_date_format']);
	?>
	
	<div class="clear_both b20">
		<form id="pjTsReportForm" action="" method="post" class="pj-form clear_both">
			<div class="r20 float_left">
				<label class="inline_block float_left t5 r10"><?php __('booking_from');?></label>
				<span class="inline_block">
					<span class="pj-form-field-custom pj-form-field-custom-after">
    					<input type="text" name="date_from" id="date_from" class="pj-form-field w80 datepick pointer required" value="<?php echo date($tpl['option_arr']['o_date_format'], time());?>" readonly="readonly" rel="<?php echo $week_start; ?>" rev="<?php echo $jqDateFormat; ?>" />
    					<span class="pj-form-field-after"><abbr class="pj-form-field-icon-date"></abbr></span>
    				</span>
				</span>
			</div>
			<div class="r20 float_left">
				<label class="inline_block float_left t5 r10"><?php __('booking_to');?></label>
				<span class="inline_block">
					<span class="pj-form-field-custom pj-form-field-custom-after">
    					<input type="text" name="date_to" id="date_to" class="pj-form-field w80 datepick pointer required" value="<?php echo date($tpl['option_arr']['o_date_format'], time());?>" readonly="readonly" rel="<?php echo $week_start; ?>" rev="<?php echo $jqDateFormat; ?>" />
    					<span class="pj-form-field-after"><abbr class="pj-form-field-icon-date"></abbr></span>
    				</span>
				</span>
			</div>
			
			<div class="r20 float_left">
				<label class="inline_block float_left t5 r10"><?php __('booking_calendar');?></label>
				<span class="inline_block">
					<select name="calendar_id" class="pj-form-field w150">
						<?php
						foreach($tpl['calendar_arr'] as $k => $v)
						{
						    ?>
						    <option value="<?php echo $v['id'];?>"<?php echo $v['id'] == $controller->getLocaleId() ? ' selected="selected"' : NULL;?>><?php echo pjSanitize::html($v['title']);?></option>
						    <?php
						}
						?>
					</select>
				</span>
			</div>
			<input type="submit" value="<?php __('btnGenerate', false, true); ?>" class="pj-button" />
		</form>
	</div>

	<div id="reportWrapper"></div>
	
	<?php
}
?>