<?php
$index = $_GET['index'];
?>
<div class="container-fluid pjTsContainer">
	<?php include PJ_VIEWS_PATH . 'pjLoad/elements/header.php'; ?>
	
	<div class="panel panel-default pjTsBody">
		<header class="panel-heading text-center">
			<p class="panel-title"><?php __('front_menu_tickets'); ?></p><!-- /.panel-title -->
		</header><!-- /.panel-heading text-center -->
		
		<div class="table-responsive">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table table-hover pjTsTable pjTsTableTickets">
				<tr>
					<th><?php __('front_label_ticketid'); ?></th>
					<th><?php __('front_label_status'); ?></th>
					<th><?php __('front_label_replies'); ?></th>
					<th><?php __('front_label_last_reply'); ?></th>
				</tr>
				<?php
				if(!empty($tpl['ticket_arr']))
				{
					$ticket_statuses = __('ticket_statarr', true);
					foreach($tpl['ticket_arr'] as $v)
					{
						?>
						<tr>
							<td><a href="#" data-id="<?php echo $v['id']; ?>" class="pjTsTicketDetail"><?php echo pjSanitize::html($v['ticket_id']);?></a></td>
							<td><?php echo $ticket_statuses[$v['status']];?></td>
							<td><?php echo $v['cnt_replies']; ?></td>
							<?php
							if(!empty($v['last_reply']))
							{ 
								?>
								<td class="pjTsTableDate"><?php echo pjUtil::formatDate(date('Y-m-d', strtotime($v['last_reply'])), "Y-m-d", $tpl['option_arr']['o_date_format']) . ', ' . date($tpl['option_arr']['o_time_format'], strtotime($v['last_reply'])); ?></td>
								<?php
							}else{
								?><td><?php __('front_na'); ?></td><?php
							} 
							?>
						</tr>
						<?php
					}
				} else {
					?>
					<tr>
						<td colspan="4"><?php __('front_no_ticket_found'); ?></td>
					</tr>
					<?php
				}
				?>
			</table><!-- /.table table-hover pjTsTable pjTsTableTickets -->
		</div><!-- /.table-responsive -->
		
	</div><!-- /.panel panel-default pjTsBody -->
</div><!-- /.container-fluid pjTsContainer -->					