<?php
/**
* @version 1.0.0
* @package RSEvents! 1.0.0
* @copyright (C) 2009 www.rsjoomla.com
* @license GPL, http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.modal');
JHTML::_('behavior.mootools');
?>
<button onclick="document.location = '<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=tickets&layout=edit&cid=0&IdEvent='.$this->id.$this->itemId)); ?>';"><?php echo JText::_('RSE_NEW_BTN'); ?></button>
<button onclick="document.location = '<?php echo  html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=addeditevent&cid='.$this->id.':'.JFilterOutput::stringURLSafe($this->evName).$this->itemId)); ?>';"><?php echo JText::_('RSE_BACK_BTN'); ?></button>
<br/><br/>
<form action="<?php echo JRoute::_('index.php?option=com_rsevents'); ?>" method="post" name="adminForm">	
		<table class="rseventsTickets"	width="100%" cellspacing="0" cellpadding="3" border="0" >
			<thead>
				<tr>
					<th width="1%">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->data); ?>);"/>
					</th>
					<th width="40%">
						<?php
							echo JText::_('RSE_TICKETS_NAME');
						?>
					</th>
					<th width="20%" style="text-align:center;">
						<?php
							echo JText::_( 'RSE_TICKETS_SEATS' ); 
						?>
					</th>
					<th width="17%" style="text-align:center;">
						<?php
							echo JText::_( 'RSE_TICKETS_PRICE' ); 
						?>
					</th>
					<th width="20%" style="text-align:center;">
						<?php
							echo JText::_('RSE_ORDER');
							echo '&nbsp;&nbsp;';
							echo '<a href="#" onclick="document.adminForm.toggle.checked=\'checked\';checkAll('.count($this->data).');document.adminForm.task.value=\'saveOrder\';document.adminForm.submit.click();" title="Save Order"><img src="'.JURI::root().'components/com_rsevents/images/filesave.png" alt="Save Order" /></a>';
						?>
						
					</th>
					<th width="1%">
						<?php
							echo JText::_( 'RSE_TICKETS_DELETE' ); 
						?>
					</th>
				</tr>
			</thead>
			<tbody>
	<?php
	$k = 0;
	for ($i=0,$n=count($this->data);$i<$n;$i++)
	{		
		$row =& $this->data[$i];
		$checked=JHTML::_('grid.id',$i,$row->RecordId);
	?>
			<tr class="<?php echo "row$k"; ?>">
				<td align="center"><?php echo $checked; ?></td>
				<td><a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=tickets&layout=edit&cid='.$row->RecordId.'&IdEvent='.$this->id.$this->itemId)); ?>"><?php echo $row->TicketName; ?></a></td>
				<td align="center"><?php echo $row->TicketMaxAudience; ?></td>
				<td align="center"><?php echo ($row->TicketPrice == '0') ? $row->TicketPrice.' ('.JText::_('RSE_TICKETS_FREE').')' : $row->TicketPrice ; ?></td>
				<td class="order" align="center" width="100">
					<input type="text" name="order[]" size="1" value="<?php echo $row->ordering; ?>" class="text_area" style="text-align:center;" />
				</td>
				<td align="center"><a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&task=deleteticket&controller=tickets&cid='.$row->RecordId.'&IdEvent='.$this->id.$this->itemId)); ?>" onclick="javascript:if(!confirm('<?php echo JText::_('RSE_TICKETS_CONFIRM_DELETE'); ?>)) return false;"><img src="<?php echo JURI::root().'administrator/components/com_rsevents/images/icons/delete.png'; ?>" title="Delete" alt="Delete file"></a></td>
			</tr>
	<?php	$k=1-$k;
	}
	?>
			</tbody>
				</table>				
<?php echo JHTML::_( 'form.token' ); ?>
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="layout" value="" />
<input type="hidden" name="option" value="com_rsevents" />
<input type="hidden" name="IdEvent" value="<?php  echo $this->id; ?>" />
<input type="hidden" name="view" value="tickets" />
<input type="hidden" name="controller" value="tickets" />
<input type="hidden" name="task" value="saveOrder" />
<input type="submit" name="submit"  value="submit" style="display:none;"/>
</form>