<?php

/**
 * @var bool $confirmation
 */
$this->layout('system::layout/default');
$this->sectionReplace('sidebar-menu', $this->fetch('admin::sidebar-admin-menu', ['sys_menu' => ['languages' => true]]));
?>
<?php if ($message): ?>
    <div class="alert alert-success"><?= $message ?></div>
<?php endif; ?>
<div>
    <?php foreach ($languages as $key => $val): ?>
        <div class="new_post-item without_avatar">
            <div class="d-flex justify-content-between">
                <div>
                    <?php if (! empty($val['flag'])): ?>
                        <img src="<?= $val['flag'] ?>" alt="." class="mr-2">
                    <?php endif ?>
                    <?= $val['name'] ?>
                </div>
            </div>
            <div class="post-body">
                <span class="mr-2"><?= __('Version:') ?> <?= number_format($val['version'], 1) ?></span>
                <?php if (! empty($val['need_update'])): ?>
                    <span class="mr-2 font-weight-bold"><?= __('New version:') ?> <?= number_format($val['new_version'], 1) ?></span>
                <?php endif; ?>
                <?php if (! empty($val['installed'])): ?>
                    <span class="text-success"><?= __('Installed') ?></span>
                <?php else: ?>
                    <span class="text-danger"><?= __('Not installed') ?></span>
                <?php endif; ?>
            </div>
            <div class="post-meta">
                <?php if (! empty($val['installed'])): ?>
                    <a href="/admin/languages/?action=delete&code=<?= $key ?>" class="mr-2"><?= __('Delete') ?></a>
                <?php else: ?>
                    <a href="/admin/languages/?action=install&code=<?= $key ?>" class="mr-2"><?= __('Install') ?></a>
                <?php endif; ?>
                <?php if (! empty($val['need_update'])): ?>
                    <a href="/admin/languages/?action=update&code=<?= $key ?>"><?= __('Update') ?></a>
                <?php endif; ?>
            </div>
        </div>
    <?php endforeach ?>
    <div class="mt-3">
        <a href="/admin/languages/"><?= __('Back') ?></a>
    </div>
</div>
