<?php

/**
 * @var $csrf_token
 * @var \Guestbook\Models\Guestbook $message
 * @var $errors
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => __('Reply'),
        'page_title' => __('Reply'),
    ]
); ?>

<h4><?= __('Reply') ?></h4>
<?php if (! empty($errors['csrf_token'])): ?>
    <div class="alert alert-danger"><?= implode(', ', $errors['csrf_token']) ?></div>
<?php endif ?>
<form action="/guestbook/otvet?id=<?= $id ?>" method="post">
    <input type="hidden" name="csrf_token" value="<?= $csrf_token ?>"/>
    <p>
        <b><?= __('Author') ?>:</b> <?= $message->name ?> <br>
        <?= $message->post_text ?>
    <p>
    <div class="form-group">
        <label for="message"><?= __('Reply') ?></label>
        <div><?= $bbcode ?></div>
        <textarea rows="<?= $user->config->fieldHeight ?>" name="message" id="message" class="form-control"><?= $this->e($message->otvet) ?></textarea>
        <?php if (! empty($errors['message'])): ?>
            <div class="invalid-feedback d-block"><?= implode(', ', $errors['message']) ?></div>
        <?php endif ?>
    </div>
    <div>
        <button type="submit" name="submit" value="submit" class="btn btn-primary mr-2"><?= __('Save') ?></button>
        <a href="/guestbook/" class="btn btn-outline-primary"><?= __('Back') ?></a>
    </div>
</form>
