<?php

/**
 * @var Mobicms\Render\Template\Template $this
 * @var int $id
 * @var \Illuminate\Support\Collection<int, \Johncms\Modules\Forum\Domain\Models\ForumSection> $sections
 * @var \Illuminate\Support\Collection<int, \Johncms\Modules\Forum\Domain\Models\ForumSection> $categories
 * @var string $form_action
 * @var string $back_url
 * @var bool $can_destroy
 * @var string $csrf_token
 */

$this->layout('system::layout/default');
?>

<div class="alert alert-danger">
    <div class="pb-2">
        <?= __('<h3>WARNING!</h3>There are topics in the section. You must move them to another section.') ?>
    </div>
</div>
<div>
    <form action="<?= $this->e($form_action) ?>" method="post">
        <input type="hidden" name="csrf_token" value="<?= $csrf_token ?>">
        <h3><?= __('Select section') ?></h3>
        <?php foreach ($sections as $section): ?>
            <div class="form-check">
                <input type="radio" id="sect_<?= $section->id ?>" name="subcat" value="<?= $section->id ?>" class="form-check-input">
                <label class="form-check-label" for="sect_<?= $section->id ?>"><?= $this->e($section->name) ?></label>
            </div>
        <?php endforeach; ?>
        <h3 class="mt-3"><?= __('Other category') ?></h3>
        <ul>
            <?php foreach ($categories as $category): ?>
                <li><a href="/admin/forum/structure/<?= $id ?>/delete?cat=<?= $category->id ?>"><?= $this->e($category->name) ?></a></li>
            <?php endforeach; ?>
        </ul>
        <div class="alert alert-info">
            <?= __('All the topics and files will be moved to selected section. Old section will be deleted.') ?>
        </div>
        <div class="mb-3">
            <button type="submit" name="submit" value="1" class="btn btn-danger"><?= __('Move') ?></button>
        </div>
        <?php if ($can_destroy): ?>
            <div class="mb-2">
                <h3><?= __('Complete removal') ?></h3>
                <?= __('WARNING! All the information will be deleted') ?>
            </div>
            <button type="submit" name="delete" value="1" class="btn btn-danger"><?= __('Delete') ?></button>
        <?php endif; ?>
        <a href="<?= $this->e($back_url) ?>" class="btn btn-outline-secondary"><?= __('Cancel') ?></a>
    </form>
</div>
