<?php
if (isset($tpl['status']))
{
	$status = __('status', true);
	switch ($tpl['status'])
	{
		case 2:
			pjUtil::printNotice(NULL, $status[2]);
			break;
	}
} else {
	if (isset($_GET['err']))
	{
		$titles = __('error_titles', true);
		$bodies = __('error_bodies', true);
		pjUtil::printNotice(@$titles[$_GET['err']], @$bodies[$_GET['err']]);
	}
	pjUtil::printNotice(__('infoOffersTitle', true), __('infoOffersDesc', true));
	?>
	<div class="b10">
		<select id="filter_product_id" name="product_id" class="pj-form-field float_left w200">
			<option value="">-- <?php __('lblAllProducts'); ?> --</option>
			<?php
			foreach($tpl['product_arr'] as $k => $v)
			{
				?><option value="<?php echo $v['id'];?>"<?php echo isset($_GET['product_id']) ? ($v['id'] == $_GET['product_id'] ? ' selected="selected"' : null ) : NULL;?>><?php echo $v['name'];?></option><?php
			} 
			?>
		</select>
		<?php
		$type_action = __('type_action', 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="email"><?php echo $type_action['email']; ?></a>
			<a href="#" class="pj-button btn-filter btn-status" data-column="status" data-value="promo"><?php echo $type_action['promo']; ?></a>
			<a href="#" class="pj-button btn-filter btn-status" data-column="status" data-value="thank"><?php echo $type_action['thank']; ?></a>
		</div>
		<br class="clear_both" />
	</div>
	
	<div id="grid"></div>
	<?php
	$filter = __('filter', true); 
	?>
	<script type="text/javascript">
		var pjGrid = pjGrid || {};
		pjGrid.queryString = "";
		<?php
		if (isset($_GET['product_id']) && (int) $_GET['product_id'] > 0)
		{
			?>pjGrid.queryString += "&product_id=<?php echo (int) $_GET['product_id']; ?>";<?php
		}
		if (isset($_GET['ip']) && $_GET['ip'] != '')
		{
			?>pjGrid.queryString += "&ip=<?php echo $_GET['ip']; ?>";<?php
		}
		?>
		var myLabel = myLabel || {};
		myLabel.name = "<?php __('lblProductName'); ?>";
		myLabel.type = "<?php __('lblType'); ?>";
		myLabel.price = "<?php __('lblOfferedPrice'); ?>";
		myLabel.received = "<?php __('lblReceived'); ?>";
		myLabel.exported = "<?php __('lblExport', false, true); ?>";
		myLabel.status = "<?php __('lblStatus'); ?>";
		myLabel.active = "<?php echo $filter['active']; ?>";
		myLabel.inactive = "<?php echo $filter['inactive']; ?>";
		myLabel.delete_selected = "<?php __('delete_selected'); ?>";
		myLabel.delete_confirmation = "<?php __('delete_confirmation'); ?>";
	</script>
	<?php
}
?>