<?php

/**
 * This file is part of JohnCMS Content Management System.
 *
 * @copyright JohnCMS Community
 * @license   https://opensource.org/licenses/GPL-3.0 GPL-3.0
 * @link      https://johncms.com JohnCMS Project
 */

/**
 * @var Mobicms\Render\Template\Template $this
 * @var $title
 * @var $page_title
 * @var $data
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $page_title,
    ]
);
?>

<div class="row">
    <div class="col-md-6">
        <?php if (empty($data['items'])): ?>
            <?= $this->fetch(
                'system::app/alert',
                [
                    'alert_type' => 'alert-info',
                    'alert'      => __('The list is empty'),
                ]
            ) ?>
        <?php else: ?>
            <div class="list-group">
                <?php foreach ($data['items'] as $item): ?>
                    <a href="<?= $item['url'] ?>" class="list-group-item d-flex justify-content-between align-items-center">
                        <?= $item['name'] ?>
                        <span class="badge rounded-pill"><?= $item['count'] ?></span>
                    </a>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>
        <div class="mt-3">
            <a href="<?= $data['back_url'] ?>"><?= __('Back') ?></a>
        </div>
    </div>
</div>
