<?php
/**
 * @version		3.0.0
 * @package		JomLand TicketCenter
 * @copyright	Copyright (C) 2010 JomLand.com. All rights reserved.
 * @link 		www.jomland.com
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php" method="post" name="adminForm" id="adminForm">

	<table>
	<?php if (!empty($this->fb_link)){?>
		<tr>
			<td align="right" colspan="10"><?php echo $this->fb_link->fb_login;?>
			</td>
		</tr>
		<?php }?>
		<tr>
			<td align="left" width="100%"><?php echo JText::_( 'Filter' ); ?>: <input
				type="text" name="search" id="search"
				value="<?php echo htmlspecialchars($this->lists['search']);?>"
				class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();">
				<?php echo JText::_( 'Go' ); ?>
				</button>

				<button
					onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';document.getElementById('filter_country').value='';this.form.getElementById('filter_states').value='';this.form.getElementById('filter_city').value='';this.form.submit();">
					<?php echo JText::_( 'Filter Reset' ); ?>
				</button>
			</td>
			<td nowrap="nowrap"><?php
			echo $this->lists['filter_performer'];
			//echo $this->lists['cat_id'];
			echo $this->lists['filter_venue'];
			echo $this->lists['filter_city'];
			echo $this->lists['filter_states'];
			echo $this->lists['filter_country'];
			echo $this->lists['state'];
			?>
			</td>
		</tr>
	</table>

	<div id="editcell">
		<table class="table table-striped">
			<thead>
				<tr>

					<th width="20"><input type="checkbox" name="toggle" value="" onclick="Joomla.checkAll(this)" />
					</th>
					<th><?php echo JHTML::_('grid.sort',JText::_('Event'),'e.event_name',@$this->lists['order_Dir'], @$this->lists['order']);?>
					</th>
					<th><?php echo JHTML::_('grid.sort',JText::_('Date'),'e.event_date',@$this->lists['order_Dir'], @$this->lists['order']);?>
					</th>
					<th><?php echo JHTML::_('grid.sort',JText::_('Performer'),'p.performer_name',@$this->lists['order_Dir'], @$this->lists['order']);?>
					</th>
					<th><?php echo JHTML::_('grid.sort',JText::_('Venue'),'v.venue_name',@$this->lists['order_Dir'], @$this->lists['order']);?>
					</th>

					<?php if ($this->params->get('display_city',0)>0){ ?>
					<th><?php echo JHTML::_('grid.sort',JText::_('City'),'city.city_name',@$this->lists['order_Dir'], @$this->lists['order']);?>
					</th>
					<?php }?>

					<?php if ($this->params->get('display_state',0)>0){ ?>
					<th><?php echo JHTML::_('grid.sort',JText::_('State'),'state.state_name',@$this->lists['order_Dir'], @$this->lists['order']);?>
					</th>
					<?php }?>

					<?php if ($this->params->get('display_country',0)>0){ ?>
					<th><?php echo JHTML::_('grid.sort',JText::_('Country'),'country.country',@$this->lists['order_Dir'], @$this->lists['order']);?>
					</th>
					<?php }?>

					<th><?php echo JText::_('Tickets');?>
					</th>
					<th><?php echo JText::_('Ordered');?>
					</th>
					<th><?php echo JText::_('Sold');?>
					</th>


					<th style="width: 20px;"><?php echo JHTML::_('grid.sort',   'Published', 'e.published', @$lists['order_Dir'], @$lists['order'] ); ?>
					</th>

					<th width="5"><?php echo JHTML::_('grid.sort',JText::_('ID'),'e.id',@$this->lists['order_Dir'], @$this->lists['order']);?>
					</th>

					<th><?php echo JText::_('JLTC_EVENTS_MANAGE_ACTION');?>
					</th>
				</tr>
			</thead>
			<?php
			$k = 0;
			for ($i=0, $n=count( $this->items ); $i < $n; $i++)	{
				$row = &$this->items[$i];
				$checked 	= JHTML::_('grid.id',   $i, $row->id);
				$link 		= JRoute::_( 'index.php?option=com_jlticketcenter&controller=events&task=edit&cid[]='.$row->id);


				$row->published = $row->published;
				$published		= JHTML::_('grid.published', $row, $i );
				$checked		= JHTML::_('grid.checkedout',   $row, $i );

				?>
			<tr class="<?php echo "row$k"; ?>">


				<td><?php echo $checked; ?>
				</td>
				<td><a href="<?php echo $link;?>"> <?php echo $row->event_name; ?> </a>
				</td>
				<td><?php echo JHTML::_('date', $row->event_date, JText::_('DATE_FORMAT_LC3').' H:i',null);?>
				</td>
				<td><?php echo $row->performer_name;?>
				</td>
				<td><?php echo $row->venue_name; ?>
				</td>

				<?php if ($this->params->get('display_city',0)>0){?>
				<td><?php echo $row->city_name; ?>
				</td>
				<?php }?>

				<?php if ($this->params->get('display_state',0)>0){ ?>
				<td><?php echo $row->state_name; ?>
				</td>
				<?php }?>
				<?php if ($this->params->get('display_country',0)>0){ ?>
				<td><?php echo $row->country;?>
				</td>
				<?php }?>
				<td><?php echo $row->tickets;?>
				</td>

				<td><?php echo $row->tickets_ordered;?>
				</td>
				<td><?php echo $row->tickets_sold;?>
				</td>
				<td><?php echo $published; ?>
				</td>
				<td><?php echo $row->id; ?>
				</td>

				<td><span style="font-size: 0.8em;"> <?php $guest_url=JRoute::_('index.php?option=com_jlticketcenter&controller=events&format=raw&task=guest&id='.$row->id); 
				echo JHtml::link($guest_url, JText::_('JLTC_GUESTS_LIST'),'target="_blank"'); ?>
				</span> <?php if ($this->csv_available){?> <span
					style="font-size: 0.8em;"> , <?php $guest_url=JRoute::_('index.php?option=com_jlticketcenter&controller=events&format=raw&task=csv&id='.$row->id); 
					echo JHtml::link($guest_url, JText::_('JLTC_GUESTS_LIST_CSV'),'target="_blank"'); ?>
				</span> <?php }?>
				</td>
			</tr>
			<?php
			$k = 1 - $k;
			}
			?>
			<tfoot>
				<tr>
					<td colspan="15"><?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>

		</table>
	</div>

	<input type="hidden" name="option" value="com_jlticketcenter" /> <input
		type="hidden" name="task" value="" /> <input type="hidden"
		name="boxchecked" value="0" /> <input type="hidden" name="controller"
		value="events" /> <input type="hidden" name="filter_order"
		value="<?php echo $this->lists['order']; ?>" /> <input type="hidden"
		name="filter_order_Dir"
		value="<?php echo $this->lists['order_Dir']; ?>" />

		<?php echo JHTML::_( 'form.token' ); ?>
</form>
