<?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' => $page_title,
    ]
);
$form_data = $data['form_data'] ?? [];
?>

<form name="file_edit_form" action="<?= $data['action_url'] ?>" method="post" enctype="multipart/form-data">
    <?php if (! empty($data['error_message'])): ?>
        <?= $this->fetch(
            'system::app/alert',
            [
                'alert_type' => 'alert-danger border-0',
                'alert'      => $data['error_message'],
            ]
        ) ?>
    <?php endif; ?>

    <div class="mb-3">
        <img src="<?= $data['image_url'] ?>" alt=".">
    </div>

    <div class="form-group">
        <label for="description"><?= __('Description') ?></label>
        <textarea id="description" name="description" class="form-control" rows="<?= $user->config->fieldHeight ?>"><?= $data['description'] ?></textarea>
    </div>
    <div class="mt-3">
        <button type="submit" name="submit" value="1" class="btn btn-primary"><?= __('Save') ?></button>
        <a href="<?= $data['back_url'] ?>" class="btn btn-secondary"><?= __('Cancel') ?></a>
    </div>
</form>
