<?php echo $this->partial('Layout/nav'); ?>

<div class="container">
	<div class="container-page-wrapper">
		<div class="container-page-container">
			<h1><?php echo $this->actionTitle; ?></h1>
			<hr>
			<?php //debug($this->view->sessions); ?>
			
			<?php if(is_array($this->view->sessions) && !empty($this->view->sessions)): ?>
				<div class="table-overflow">
					<table  class="table table-hover">
						<thead class="thead-light">
							<tr>
								<th><?php echo _('Username'); ?></th>
								<th><?php echo _('Surname'); ?></th>
								<th><?php echo _('Name'); ?></th>
								<th><?php echo _('IP'); ?></th>
								<th><?php echo _('GMT action'); ?></th>
								<th><?php echo _('Last action'); ?></th>
								<th></th>
							</tr>
						</thead>
						
						<tbody>
							<?php foreach($this->view->sessions as $session): ?>
								<tr>
									<td><?php echo $session['username']; ?></td>
									<td><?php echo $session['surname']; ?></td>
									<td><?php echo $session['name']; ?></td>
									<td><?php echo $session['user_ip']; ?></td>
									<td><?php echo $this->helper->getDateString($session['session_updated_at']); ?></td>
									<td><?php echo $this->helper->dateIntervalString($session['session_updated_at']); ?></td>
									<td><button type="button" class="btn btn-info btn-sm"><?php echo _('Disconnect'); ?></button></td>
								</tr>
							<?php endforeach; ?>
						</tbody>
					</table>
				</div>
				<?php echo $this->partial('Layout/pagination'); ?>
			<?php else: ?>
			<?php endif; ?>
		</div>
	</div>
</div>