fisharebest/webtrees

View on GitHub
resources/views/search-phonetic-page.phtml

Summary

Maintainability
Test Coverage
<?php

declare(strict_types=1);

use Fisharebest\Webtrees\Http\RequestHandlers\SearchPhoneticAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Tree;
use Illuminate\Support\Collection;

/**
 * @var Collection<int,Tree>       $all_trees
 * @var string                     $firstname
 * @var Collection<int,Individual> $individuals
 * @var string                     $lastname
 * @var string                     $place
 * @var Collection<int,Tree>       $search_trees
 * @var string                     $soundex
 * @var string                     $title
 * @var Tree                       $tree
 */

?>

<h2 class="wt-page-title">
    <?= $title ?>
</h2>

<form method="post" action="<?= e(route(SearchPhoneticAction::class, ['tree' => $tree->name()])) ?>" class="wt-page-options wt-page-options-ancestors-chart hidden-print mb-4" name="searchform">
    <div class="row">
        <label class="col-sm-3 col-form-label wt-page-options-label" for="firstname">
            <?= I18N::translate('Given name') ?>
        </label>
        <div class="col-sm-9 wt-page-options-value">
            <div class="input-group">
                <input class= "form-control" type="text" name="firstname" id="firstname" value="<?= e($firstname) ?>" autofocus>
                <?= view('edit/input-addon-keyboard', ['id' => 'firstname']) ?>
            </div>
        </div>
    </div>

    <div class="row">
        <label class="col-sm-3 col-form-label wt-page-options-label"  for="lastname">
            <?= I18N::translate('Surname') ?>
        </label>
        <div class="col-sm-9 wt-page-options-value">
            <div class="input-group">
                <input class="form-control" type="text" name="lastname" id="lastname" value="<?= e($lastname) ?>">
                <?= view('edit/input-addon-keyboard', ['id' => 'lastname']) ?>
            </div>
        </div>
    </div>

    <div class="row">
        <label class="col-sm-3 col-form-label wt-page-options-label" for="place">
            <?= I18N::translate('Place') ?>
        </label>
        <div class="col-sm-9 wt-page-options-value">
            <input class="form-control" type="text" name="place" id="place" value="<?= e($place) ?>">
        </div>
    </div>

    <fieldset class="row">
            <label class="col-sm-3 col-form-label wt-page-options-label">
            <?= I18N::translate('Phonetic algorithm') ?>
        </label>
        <div class="col-sm-9 wt-page-options-value">
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" name="soundex" value="Russell" <?= $soundex === 'Russell' ? 'checked' : '' ?> id="russell">
                <label class="form-check-label" for="russell">
                    <?= I18N::translate('Russell') ?>
                </label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" name="soundex" value="DaitchM" <?= $soundex === 'DaitchM' ? 'checked' : '' ?> id="d-m">
                <label class="form-check-label" for="d-m">
                    <?= I18N::translate('Daitch-Mokotoff') ?>
                </label>
            </div>
        </div>
    </fieldset>

    <?= view('search-trees', ['all_trees' => $all_trees, 'search_trees' => $search_trees]) ?>

    <div class="row">
        <label class="col-sm-3 col-form-label wt-page-options-label"></label>
        <div class="col-sm-9 wt-page-options-value">
            <input type="submit" class="btn btn-primary" value="<?=  /* I18N: A button label. */ I18N::translate('search') ?>">
        </div>
    </div>

    <?= csrf_field() ?>
</form>

<?php if ($firstname !== '' || $lastname !== '' || $place !== '') : ?>
    <?php if ($individuals->isEmpty()) : ?>
        <div class="alert alert-info row">
            <?= I18N::translate('No results found.') ?>
        </div>
    <?php else : ?>
        <?= view('search-results', ['individuals' => $individuals, 'search_families' => false, 'search_individuals' => true, 'search_locations' => false, 'search_notes' => false, 'search_sources' => false, 'search_repositories' => false, 'tree' => $tree]) ?>
    <?php endif ?>
<?php endif ?>

<?= view('modals/on-screen-keyboard') ?>