<?php

declare(strict_types=1);

use Fisharebest\Webtrees\I18N;

/**
 * @var string               $controls
 * @var string               $filter
 * @var array<string,string> $filters
 * @var array<string,string> $formats
 * @var string               $start
 * @var int                  $delay
 */

?>

<div class="row mb-3">
    <label class="col-sm-3 col-form-label" for="filter">
        <?= I18N::translate('Show only individuals, events, or all') ?>
    </label>
    <div class="col-sm-9">
        <?= view('components/select', ['name' => 'filter', 'selected' => $filter, 'options' => ['indi' => I18N::translate('Individuals'), 'event' => I18N::translate('Facts and events'), 'all' => I18N::translate('All')]]) ?>
    </div>
</div>

<fieldset class="row mb-3">
    <legend class="col-form-label col-sm-3">
        <?= I18N::translate('Type') ?>
    </legend>
    <div class="col-sm-9">
        <?php foreach ($formats as $type => $label) : ?>
            <?= view('components/checkbox', ['label' => $label, 'name' => $type, 'checked' => (bool) $filters[$type]]) ?>
        <?php endforeach ?>
    </div>
</fieldset>

<div class="row mb-3">
    <label class="col-sm-3 col-form-label" for="controls">
        <?= I18N::translate('Show slide show controls') ?>
    </label>
    <div class="col-sm-9">
        <?= view('components/radios-inline', ['name' => 'controls', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) $controls]) ?>
    </div>
</div>

<div class="row mb-3">
    <label class="col-sm-3 col-form-label" for="start">
        <?= I18N::translate('Start slide show on page load') ?>
    </label>
    <div class="col-sm-9">
        <?= view('components/radios-inline', ['name' => 'start', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) $start]) ?>
    </div>
</div>

<div class="row mb-3">
    <label for="delay" class="col-sm-3 col-form-label">
        <?= I18N::translate('Slide show interval') ?>
    </label>
    <div class="col-sm-9">
        <div class="input-group">
            <input type="number" name="delay" id="delay" class="form-control" value="<?= $delay ?>" min="1" max="999">
            <span class="input-group-text"><?= I18N::translate('seconds') ?></span>
        </div>
    </div>
</div>
