<?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']]);
	}
	?>
	<div class="ui-tabs ui-widget ui-widget-content ui-corner-all b10">
		<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
			<li class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminEnquiries&amp;action=pjActionIndex"><?php __('menuEnquiries'); ?></a></li>
			<li class="ui-state-default ui-corner-top"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminEnquiries&amp;action=pjActionCreate"><?php __('lblAddEnquiry'); ?></a></li>
		</ul>
	</div>
	
	<?php pjUtil::printNotice(@$titles['AE10'], @$bodies['AE10']); ?>
	
	<div class="b10">
		<form action="" method="get" class="float_left pj-form frm-filter">
			<input type="text" name="q" class="pj-form-field pj-form-field-search w150" placeholder="<?php __('btnSearch', false, true); ?>" />
			<button type="button" class="pj-button pj-button-detailed"><span class="pj-button-detailed-arrow"></span></button>
		</form>
		
		<?php
		$rs = __('enquiry_statuses', true);
		?>
		<div class="float_right t5">
			<a href="#" class="pj-button btn-all"><?php __('lblAll'); ?></a>
			<a href="#" class="pj-button btn-filter btn-status" data-column="status" data-value="Confirmed"><?php echo $rs['Confirmed']; ?></a>
			<a href="#" class="pj-button btn-filter btn-status" data-column="status" data-value="New"><?php echo $rs['New']; ?></a>
		</div>
		<br class="clear_both" />
	</div>
	
	<div class="pj-form-filter-advanced" style="display: none">
		<span class="pj-menu-list-arrow"></span>
		<form action="" method="get" class="form pj-form pj-form-search frm-filter-advanced">
			<div class="float_left w350">
				<p>
					<label class="title"><?php __('lblKeyword'); ?></label>
					<input type="text" name="q" class="pj-form-field w150" placeholder="<?php __('btnSearch', false, true); ?>" />
				</p>
			</div>
			<div class="float_right w350">
				<p>
					<label class="title"><?php __('vk_listing'); ?></label>
					<select name="listing_id" class="pj-form-field w200">
						<option value="">-- <?php __('lblChoosePackage'); ?> --</option>
						<?php
						foreach ($tpl['listing_arr'] as $item)
						{
							?><option value="<?php echo $item['id']; ?>"><?php echo pjSanitize::html($item['title']); ?></option><?php
						}
						?>
					</select>
				</p>
			</div>
			<br class="clear_both" />
			<p>
				<label class="title">&nbsp;</label>
				<input type="submit" value="<?php __('btnSearch', false, true); ?>" class="pj-button" />
				<input type="reset" value="<?php __('btnCancel', false, true); ?>" class="pj-button" />
			</p>
		</form>
	</div>

	<div id="grid"></div>
	<script type="text/javascript">
	var pjGrid = pjGrid || {};
	pjGrid.jqDateFormat = "<?php echo pjUtil::jqDateFormat($tpl['option_arr']['o_date_format']); ?>";
	pjGrid.jsDateFormat = "<?php echo pjUtil::jsDateFormat($tpl['option_arr']['o_date_format']); ?>";
	pjGrid.queryString = "";
	<?php
	if (isset($_GET['listing_id']) && (int) $_GET['listing_id'] > 0)
	{
		?>pjGrid.queryString += "&listing_id=<?php echo (int) $_GET['listing_id']; ?>";<?php
	}
	$statuses = __('enquiry_statuses', true);
	?>
	var myLabel = myLabel || {};
	myLabel.dt = "<?php __('vk_dt'); ?>";
	myLabel.listing = "<?php __('vk_listing'); ?>";
	myLabel.date_submitted = "<?php __('vk_date_submitted'); ?>";
	myLabel.export_selected = "<?php __('vk_export_selected'); ?>";
	myLabel.delete_selected = "<?php __('vk_delete_selected'); ?>";
	myLabel.confirm_selected = "<?php __('vk_confirm_selected'); ?>";
	myLabel.dismiss_selected = "<?php __('vk_dismiss_selected'); ?>";
	myLabel.delete_confirmation = "<?php __('vk_delete_confirmation'); ?>";
	myLabel.status = "<?php __('lblStatus'); ?>";
	myLabel.client = "<?php __('lblEnquiryName', false, true); ?>";
	myLabel.new_stat = "<?php echo $statuses['New']; ?>";
	myLabel.confirmed_stat = "<?php echo $statuses['Confirmed']; ?>";
	myLabel.empty_date = "<?php __('gridEmptyDate'); ?>";
	myLabel.invalid_date = "<?php __('gridInvalidDate'); ?>";
	myLabel.empty_datetime = "<?php __('gridEmptyDateTime'); ?>";
	myLabel.invalid_datetime = "<?php __('gridInvalidDateTime'); ?>";
	myLabel.lblEdit = "<?php __('lblEdit', false, true);?>";
	myLabel.lblDelete = "<?php __('lblDelete', false, true);?>";
	</script>
	<?php
}
?>