<?php

/**
 * @package         Smile Pack
 * @version         1.2.3 Pro
 * 
 * @author          Tassos Marinos <info@tassos.gr>
 * @link            http://www.tassos.gr
 * @copyright       Copyright © 2019 Tassos Marinos All Rights Reserved
 * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/

defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Language\Text;
?>
<p><?php echo Text::_('COM_SMILEPACK_SMARTTAGS_INTRO1'); ?></p>
<p><?php echo Text::_('COM_SMILEPACK_SMARTTAGS_INTRO2'); ?></p>



<div class="smilepack-table-wrapper">
    <table>
        <thead>
            <tr>
                <th><?php echo Text::_('COM_SMILEPACK_SMART_TAG'); ?></th>
                <th><?php echo Text::_('NR_DESCRIPTION'); ?></th>
                <th><?php echo Text::_('NR_DOCUMENTATION'); ?></th>
            </tr>
        </thead>
        <tbody>
            <?php
            foreach ($this->get('smartTags') as $category_label => $list)
            {
                ?>
                <tr>
                    <td colspan="3" class="smilepack-table-category"><?php echo $category_label; ?></td>
                </tr>
                <?php
                foreach ($list as $key => $item)
                {
                    $doc_id = isset($item['doc_id']) ? $item['doc_id'] : str_replace('.', '', $key);
                    $isPro = isset($item['pro']) && $item['pro'];
                    $smartTag = '&lcub;sp ' . $key . '&rcub;';
                    ?>
                    <tr>
                        <td>
                            <?php if ($isPro): ?>
                                <div class="smilepack-pro-tag" data-pro-only="<?php echo sprintf(Text::_('COM_SMILEPACK_SMART_TAG_X'), $smartTag); ?>">
                                    <span class="smilepack-pro-tag--badge"><?php echo Text::_('NR_PRO'); ?></span>
                                    <span class="smilepack-pro-tag--content"><?php echo $smartTag; ?></span>
                                </div>
                            <?php else: ?>
                                <span class="smilepack-copy-to-clipboard-trigger">
                                    <span class="smilepack-copy-to-clipboard-text"><?php echo $smartTag; ?></span>
                                    <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M362.308-260.001q-30.308 0-51.307-21-21-21-21-51.308v-455.382q0-30.308 21-51.308 20.999-21 51.307-21h335.383q30.307 0 51.307 21 21 21 21 51.308v455.382q0 30.308-21 51.308t-51.307 21H362.308Zm0-59.999h335.383q4.615 0 8.462-3.846 3.846-3.847 3.846-8.463v-455.382q0-4.616-3.846-8.463-3.847-3.846-8.462-3.846H362.308q-4.616 0-8.462 3.846-3.847 3.847-3.847 8.463v455.382q0 4.616 3.847 8.463 3.846 3.846 8.462 3.846ZM222.309-120.003q-30.307 0-51.307-21-21-21-21-51.307v-515.381h59.999v515.381q0 4.616 3.846 8.462 3.847 3.847 8.462 3.847h395.382v59.998H222.309ZM349.999-320V-800-320Z" fill="currentColor" /></svg>
                                </span>
                            <?php endif; ?>
                        </td>
                        <td><?php echo $item['label']; ?></td>
                        <td><a href="https://www.tassos.gr/kb/general/smart-tags#<?php echo $doc_id; ?>" target="_blank"><?php echo Text::_('COM_SMILEPACK_READ_MORE'); ?></a></td>
                    </tr>
                    <?php
                
                }
            }
            ?>
        </tbody>
    </table>
</div>