<?php

/**
 * @var Mobicms\Render\Template\Template $this
 * @var array<string, mixed> $settings
 * @var string $form_action
 * @var string $clear_url
 * @var string|null $error_message
 * @var string|null $success_message
 * @var string $csrf_token
 */

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

<?php if (! empty($error_message)): ?>
    <div class="alert alert-danger shadow border-0"><?= $this->e($error_message) ?></div>
<?php endif; ?>
<?php if (! empty($success_message)): ?>
    <div class="alert alert-success shadow border-0"><?= $this->e($success_message) ?></div>
<?php endif; ?>

<form action="<?= $this->e($form_action) ?>" method="post">
    <input type="hidden" name="csrf_token" value="<?= $csrf_token ?>">
    <div class="form-group">
        <label for="karma_points"><?= __('Voices per day') ?></label>
        <input type="text" name="karma_points" class="form-control" id="karma_points" value="<?= (int) $settings['karma_points'] ?>">
    </div>

    <h3><?= __('Restriction for vote') ?></h3>

    <div class="form-group">
        <label for="forum"><?= __('Forum posts') ?></label>
        <input type="text" name="forum" class="form-control" id="forum" value="<?= (int) $settings['forum'] ?>">
    </div>

    <h3><?= __('General Settings') ?></h3>

    <div class="form-check">
        <input type="checkbox" class="form-check-input" name="on" value="1" id="on" <?= $settings['on'] ? 'checked' : '' ?>>
        <label class="form-check-label" for="on"><?= __('Switch module ON') ?></label>
    </div>

    <div class="form-check">
        <input type="checkbox" class="form-check-input" name="adm" value="1" id="adm" <?= $settings['adm'] ? 'checked' : '' ?>>
        <label class="form-check-label" for="adm"><?= __('Forbid to vote for the administration') ?></label>
    </div>

    <div class="mt-3">
        <input type="submit" value="<?= __('Save') ?>" class="btn btn-primary"/>
        <a href="/admin/" class="btn btn-secondary"><?= __('Cancel') ?></a>
        <a href="<?= $this->e($clear_url) ?>" class="btn btn-danger float-right"><?= __('Clear Karma') ?></a>
    </div>
</form>
