<?php
/** 
 * @package     VikRestaurants
 * @subpackage  core
 * @author      E4J s.r.l.
 * @copyright   Copyright (C) 2023 E4J s.r.l. All Rights Reserved.
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @link        https://vikwp.com
 */

// No direct access
defined('ABSPATH') or die('No script kiddies please!');

$config = VREFactory::getConfig();

?>

<style>
	.vre-cron-loginfo-head {
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10px 20px;
		box-sizing: border-box;
	}
	.vre-cron-loginfo-middle {
		padding: 0 20px;
	}
	.vre-cron-loginfo-middle pre {
		margin: 0;
	}
	.vre-cron-loginfo-metadata {
		margin: 20px 20px 0;
	}
	.vre-cron-loginfo-metadata ul {
		list-style: none;
		display: flex;
		flex-wrap: wrap;
		align-items: start;
		gap: 20px;
		margin: 10px 0;
		padding: 0;
	}
</style>

<div class="vre-cron-loginfo-head">

	<div class="vre-cron-loginfo-head-left">
		<strong><?php echo JHtml::fetch('date', $this->log->createdon, JText::translate('DATE_FORMAT_LC1') . ' ' . $config->get('timeformat')); ?></strong>
	</div>

	<div class="vre-cron-loginfo-head-right">
		<?php if ($this->log->status): ?>
			<span class="badge badge-success"><?php echo JText::translate('VROK'); ?></span>
		<?php else: ?>
			<span class="badge badge-danger"><?php echo JText::translate('VRERROR'); ?></span>
		<?php endif; ?>
	</div>

</div>

<div class="vre-cron-loginfo-middle">
	<pre><?php echo $this->log->content; ?></pre>
</div>

<?php if ($this->log->metadata): ?>
	<details class="vre-cron-loginfo-metadata">
        <summary><?php echo JText::plural('VRE_VIEW_N_SOURCES', count($this->log->metadata)); ?></summary>
        <ul>
            <?php foreach ($this->log->metadata as $metadata): ?>
                <li><?php echo $metadata->describe(); ?></li>
            <?php endforeach; ?>
        </ul>
    </details>
<?php endif; ?>
