<?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 $data
 */

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

<div class="row">
    <div class="m-sm-auto m-md-auto m-lg-0 col-sm-12 col-md-8 col-lg-7 col-xl-7">
        <?php if (! empty($data['message'])): ?>
            <?= $this->fetch(
                'system::app/alert',
                [
                    'alert_type' => 'alert-success',
                    'alert'      => $data['message'],
                ]
            ) ?>
        <?php endif; ?>
        <div class="card shadow border-0">
            <form action="<?= $data['form_action'] ?>" method="post">
                <div class="card-body">
                    <h2><?= $data['title'] ?></h2>

                    <div class="form-group">
                        <label for="ckfinder_license_name"><?= __('License name for CKFinder') ?></label>
                        <input type="text"
                               class="form-control"
                               maxlength="250"
                               name="ckfinder_license_name"
                               id="ckfinder_license_name"
                               value="<?= $data['current_settings']['ckfinder_license_name'] ?>"
                               placeholder="<?= __('License name for CKFinder') ?>"
                        >
                    </div>
                    <div class="form-group">
                        <label for="ckfinder_license_key"><?= __('License key for CKFinder') ?></label>
                        <input type="text"
                               class="form-control"
                               maxlength="250"
                               name="ckfinder_license_key"
                               id="ckfinder_license_key"
                               value="<?= $data['current_settings']['ckfinder_license_key'] ?>"
                               placeholder="<?= __('License key for CKFinder') ?>"
                        >
                        <div class="small text-muted"><a href="https://ckeditor.com/ckfinder/" target="_blank" rel="noreferrer">https://ckeditor.com/ckfinder/</a></div>
                    </div>


                    <h4 class="mt-3"><?= __('Meta tags for the main page') ?></h4>
                    <div class="form-group">
                        <label for="title"><?= __('Blog name') ?></label>
                        <input type="text"
                               class="form-control"
                               maxlength="250"
                               name="title"
                               id="title"
                               value="<?= $data['current_settings']['title'] ?>"
                               placeholder="<?= __('Blog name') ?>"
                        >
                    </div>
                    <div class="form-group">
                        <label for="meta_keywords"><?= __('Keywords') ?></label>
                        <input type="text"
                               class="form-control"
                               maxlength="500"
                               name="meta_keywords"
                               id="meta_keywords"
                               value="<?= $data['current_settings']['meta_keywords'] ?>"
                               placeholder="<?= __('Keywords') ?>"
                        >
                    </div>
                    <div class="form-group">
                        <label for="meta_description"><?= __('Description') ?></label>
                        <textarea id="meta_description" class="form-control" name="meta_description"><?= $data['current_settings']['meta_description'] ?></textarea>
                    </div>

                    <h4 class="mt-3"><?= __('Meta tag templates for sections') ?></h4>
                    <div class="form-group">
                        <label for="section_title"><?= __('Title') ?></label>
                        <input type="text"
                               class="form-control"
                               maxlength="250"
                               name="section_title"
                               id="section_title"
                               value="<?= $data['current_settings']['section_title'] ?>"
                               placeholder="<?= __('Title') ?>"
                        >
                    </div>
                    <div class="form-group">
                        <label for="section_meta_keywords"><?= __('Keywords') ?></label>
                        <input type="text"
                               class="form-control"
                               maxlength="500"
                               name="section_meta_keywords"
                               id="section_meta_keywords"
                               value="<?= $data['current_settings']['section_meta_keywords'] ?>"
                               placeholder="<?= __('Keywords') ?>"
                        >
                    </div>
                    <div class="form-group">
                        <label for="section_meta_description"><?= __('Description') ?></label>
                        <textarea id="section_meta_description"
                                  class="form-control"
                                  name="section_meta_description"><?= $data['current_settings']['section_meta_description'] ?></textarea>
                    </div>

                    <h4 class="mt-3"><?= __('Meta tag templates for articles') ?></h4>
                    <div class="form-group">
                        <label for="article_title"><?= __('Title') ?></label>
                        <input type="text"
                               class="form-control"
                               maxlength="250"
                               name="article_title"
                               id="article_title"
                               value="<?= $data['current_settings']['article_title'] ?>"
                               placeholder="<?= __('Title') ?>"
                        >
                    </div>
                    <div class="form-group">
                        <label for="article_meta_keywords"><?= __('Keywords') ?></label>
                        <input type="text"
                               class="form-control"
                               maxlength="500"
                               name="article_meta_keywords"
                               id="article_meta_keywords"
                               value="<?= $data['current_settings']['article_meta_keywords'] ?>"
                               placeholder="<?= __('Keywords') ?>"
                        >
                    </div>
                    <div class="form-group">
                        <label for="article_meta_description"><?= __('Description') ?></label>
                        <textarea id="article_meta_description"
                                  class="form-control"
                                  name="article_meta_description"><?= $data['current_settings']['article_meta_description'] ?></textarea>
                    </div>

                    <div class="d-flex flex-wrap justify-content-between">
                        <div class="mb-1 mr-1">
                            <input type="submit" name="submit" value="<?= __('Save') ?>" class="btn btn-primary"/>
                            <a href="<?= $data['back_url'] ?>" class="btn btn-secondary"><?= __('Cancel') ?></a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
