<?php
/**
 * @package     CMGiftCard
 * @subpackage  com_cmgiftcard
 * @copyright   Copyright (C) 2016-2024 CMExension
 * @license     GNU General Public License version 2 or later
 */

defined('JPATH_BASE') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;

extract($displayData);
?>
<h3><?php echo Text::_('COM_CMGIFTCARD_RECENT_SCANNED_CARDS'); ?></h3>
<?php if (count($cards)) : ?>
<table class="table table-stripe">
	<thead>
		<tr>
			<th><?php echo Text::_('COM_CMGIFTCARD_GIFT_CARD_CODE'); ?></th>
			<th><?php echo Text::_('COM_CMGIFTCARD_SCANNED_TIME'); ?></th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		<?php foreach ($cards as $code => $data) : ?>
		<tr>
			<td><a href="#" class="scanned-card" data-card-code="<?php echo $code; ?>"><?php echo $code; ?></td>
			<td><?php echo HTMLHelper::_('date', $data['date'], 'H:i'); ?></td>
			<td><?php echo \JHtmlDate::relative($data['date']); ?></td>
		</tr>
		<?php endforeach; ?>
	</tbody>
</table>
<?php else : ?>
<p><?php echo Text::_('COM_CMGIFTCARD_NO_RECENT_SCANNED_CARDS'); ?></p>
<?php endif; ?>