<?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!');

/**
 * Layout variables
 * -----------------
 * @var  array                $filters  The widget configuration.
 * @var  object[]             $notes    The visible notes.
 * @var  VREStatisticsWidget  $widget   The instance of the widget to be displayed.
 */
extract($displayData);

$config = VREFactory::getConfig();
$format = $config->get('dateformat') . ' ' . $config->get('timeformat');

?>

<div class="widget-admin-notes-wall" data-widget="<?php echo $widget->getID(); ?>">
    
    <?php foreach ($notes as $note): ?>

        <div class="admin-sticky-note" data-id="<?php echo (int) $note->id; ?>">

            <div contenteditable="true" spellcheck="false" class="sticky-note-editor">
                <?php echo $note->content; ?>    
            </div>

            <?php if ($note->author->name ?? null): ?>
                <div class="sticky-note-cite">
                    <cite>&mdash;&nbsp;<?php echo $note->author->name; ?></cite>
                </div>
            <?php endif; ?>

            <div class="sticky-note-footer">
                <div class="note-date" title="<?php echo $this->escape($note->editor->name ?? ''); ?>"><?php echo JHtml::fetch('date.relative', $note->modified ?: $note->created, null, null, $format); ?></div>
                <div class="note-actions" data-status="<?php echo (int) $note->status; ?>" data-user="<?php echo (int) $note->created_by; ?>">
                    <i class="fas fa-ellipsis-v note-actions-hndl"></i>
                </div>
            </div>

        </div>

    <?php endforeach; ?>

    <div class="admin-sticky-note add-placeholder">
        <i class="fas fa-plus-circle"></i>
    </div>

</div>
