<?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 $title
 * @var $page_title
 * @var $data
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $title,
    ]
);
$this->sectionReplace('sidebar-menu', $this->fetch('admin::sidebar-admin-menu', ['module_menu' => ['news' => true]]));
?>


<?php if (! empty($data['success_message'])): ?>
    <?= $this->fetch(
        'system::app/alert',
        [
            'alert_type' => 'alert-success',
            'alert'      => $data['success_message'],
        ]
    ) ?>
<?php endif; ?>
<form action="<?= $data['form_action'] ?>" method="post">
    <h3><?= __('Appearance') ?></h3>
    <div class="custom-control custom-radio">
        <input type="radio" class="custom-control-input" name="view" value="1" id="view1" <?= $data['settings']['view'] === 1 ? 'checked' : '' ?>>
        <label class="custom-control-label" for="view1"><?= __('Title + Text') ?></label>
    </div>
    <div class="custom-control custom-radio">
        <input type="radio" class="custom-control-input" name="view" value="2" id="view2" <?= $data['settings']['view'] === 2 ? 'checked' : '' ?>>
        <label class="custom-control-label" for="view2"><?= __('Title') ?></label>
    </div>
    <div class="custom-control custom-radio">
        <input type="radio" class="custom-control-input" name="view" value="0" id="view" <?= ! $data['settings']['view'] ? 'checked' : '' ?>>
        <label class="custom-control-label" for="view"><?= __('Not to show') ?></label>
    </div>

    <div class="custom-control custom-checkbox mt-2">
        <input type="checkbox" class="custom-control-input" name="breaks" value="1" id="breaks" <?= $data['settings']['breaks'] ? 'checked' : '' ?>>
        <label class="custom-control-label" for="breaks"><?= __('Line breaks') ?></label>
    </div>
    <div class="custom-control custom-checkbox">
        <input type="checkbox" class="custom-control-input" name="smileys" value="1" id="smileys" <?= $data['settings']['smileys'] ? 'checked' : '' ?>>
        <label class="custom-control-label" for="smileys"><?= __('Smiles') ?></label>
    </div>
    <div class="custom-control custom-checkbox">
        <input type="checkbox" class="custom-control-input" name="tags" value="1" id="tags" <?= $data['settings']['tags'] ? 'checked' : '' ?>>
        <label class="custom-control-label" for="tags"><?= __('bbCode Tags') ?></label>
    </div>
    <div class="custom-control custom-checkbox">
        <input type="checkbox" class="custom-control-input" name="kom" value="1" id="kom" <?= $data['settings']['kom'] ? 'checked' : '' ?>>
        <label class="custom-control-label" for="kom"><?= __('Comments') ?></label>
    </div>

    <div class="form-group mt-3">
        <label for="size"><?= __('Text size') ?></label>
        <input type="text" name="size" class="form-control" id="size" value="<?= $data['settings']['size'] ?>">
        <div class="text-muted small"><?= __('min:') ?> 50, <?= __('max:') ?> 500</div>
    </div>
    <div class="form-group">
        <label for="quantity"><?= __('Quantity of news') ?></label>
        <input type="text" name="quantity" class="form-control" id="quantity" value="<?= $data['settings']['quantity'] ?>">
        <div class="text-muted small"><?= __('min:') ?> 1, <?= __('max:') ?> 15</div>
    </div>
    <div class="form-group">
        <label for="days"><?= __('How many days to show?') ?></label>
        <input type="text" name="days" class="form-control" id="days" value="<?= $data['settings']['days'] ?>">
        <div class="text-muted small"><?= __('min:') ?> 1, <?= __('max:') ?> 30</div>
    </div>
    <div class="mt-3">
        <input type="submit" name="submit" value="<?= __('Save') ?>" class="btn btn-primary"/>
        <a href="/admin/" class="btn btn-secondary"><?= __('Cancel') ?></a>
    </div>
</form>
