xref: /webtrees/resources/views/search-phonetic-page.phtml (revision 5062b1ca554e9384a3865a8ed7fa201483b30720)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\SearchPhoneticAction;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\Individual;
6use Fisharebest\Webtrees\Tree;
7use Illuminate\Support\Collection;
8
9/**
10 * @var array<Tree>            $all_trees
11 * @var string                 $firstname
12 * @var Collection<Individual> $individuals
13 * @var string                 $lastname
14 * @var string                 $place
15 * @var array<Tree>            $search_trees
16 * @var string                 $soundex
17 * @var string                 $title
18 * @var Tree                   $tree
19 */
20
21?>
22
23<h2 class="wt-page-title">
24    <?= $title ?>
25</h2>
26
27<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">
28    <?= csrf_field() ?>
29
30    <div class="row form-group">
31        <label class="col-sm-3 col-form-label wt-page-options-label" for="firstname">
32            <?= I18N::translate('Given name') ?>
33        </label>
34        <div class="col-sm-9 wt-page-options-value">
35            <div class="input-group">
36                <input class= "form-control" type="text" name="firstname" id="firstname" value="<?= e($firstname) ?>" autofocus>
37                <?= view('edit/input-addon-keyboard', ['id' => 'firstname']) ?>
38            </div>
39        </div>
40    </div>
41
42    <div class="row form-group">
43        <label class="col-sm-3 col-form-label wt-page-options-label"  for="lastname">
44            <?= I18N::translate('Surname') ?>
45        </label>
46        <div class="col-sm-9 wt-page-options-value">
47            <div class="input-group">
48                <input class="form-control" type="text" name="lastname" id="lastname" value="<?= e($lastname) ?>">
49                <?= view('edit/input-addon-keyboard', ['id' => 'lastname']) ?>
50            </div>
51        </div>
52    </div>
53
54    <div class="row form-group">
55        <label class="col-sm-3 col-form-label wt-page-options-label" for="place">
56            <?= I18N::translate('Place') ?>
57        </label>
58        <div class="col-sm-9 wt-page-options-value">
59            <input class="form-control" type="text" name="place" id="place" value="<?= e($place) ?>">
60        </div>
61    </div>
62
63    <fieldset class="form-group">
64        <div class="row">
65            <label class="col-sm-3 col-form-label wt-page-options-label">
66                <?= I18N::translate('Phonetic algorithm') ?>
67            </label>
68            <div class="col-sm-9 wt-page-options-value">
69                <div class="form-check form-check-inline">
70                    <label class="form-check-label">
71                        <input class="form-check-input" type="radio" name="soundex" value="Russell" <?= $soundex === 'Russell' ? 'checked' : '' ?>>
72                        <?= I18N::translate('Russell') ?>
73                    </label>
74                </div>
75                <div class="form-check form-check-inline">
76                    <label class="form-check-label">
77                        <input class="form-check-input" type="radio" name="soundex" value="DaitchM" <?= $soundex === 'DaitchM' ? 'checked' : '' ?>>
78                        <?= I18N::translate('Daitch-Mokotoff') ?>
79                    </label>
80                </div>
81            </div>
82        </div>
83    </fieldset>
84
85    <?php if (count($all_trees) > 1) : ?>
86        <fieldset class="form-group">
87            <div class="row">
88                <label class="col-sm-3 col-form-label wt-page-options-label">
89                    <?= I18N::translate('Family trees') ?>
90                </label>
91                <div class="col-sm-9 wt-page-options-value pt-2">
92                    <div class="d-flex justify-content-between">
93                        <div id="search-trees" class="form-check">
94                            <?php foreach ($all_trees as $tree) : ?>
95                                <div class="col px-0">
96                                    <label class="form-check-label">
97                                        <input class="form-check form-check-input" type="checkbox" <?= in_array($tree, $search_trees, true) ? 'checked' : '' ?> value="<?= $tree->name() ?>" name="search_trees[]">
98                                        <?= e($tree->title()) ?>
99                                    </label>
100                                </div>
101                            <?php endforeach ?>
102                        </div>
103                        <?php if (count($all_trees) > 3) : ?>
104                            <div class="d-row align-self-end mb-2">
105                                <input type="button" class="btn btn-sm btn-secondary mx-1" value="<?= /* I18N: select all (of the family trees) */ I18N::translate('select all') ?>" onclick="$('#search-trees :checkbox').each(function(){$(this).attr('checked', true);});return false;">
106                                <input type="button" class="btn btn-sm btn-secondary mx-1" value="<?= /* I18N: select none (of the family trees) */ I18N::translate('select none') ?>" onclick="$('#search-trees :checkbox').each(function(){$(this).attr('checked', false);});return false;">
107                                <?php if (count($all_trees) > 10) : ?>
108                                    <input type="button" value="<?= I18N::translate('invert selection') ?>" onclick="$('#search-trees :checkbox').each(function(){$(this).attr('checked', !$(this).attr('checked'));});return false;">
109                                <?php endif ?>
110                            </div>
111                        <?php endif ?>
112                    </div>
113                </div>
114            </div>
115        </fieldset>
116    <?php endif ?>
117
118    <div class="row form-group">
119        <label class="col-sm-3 col-form-label wt-page-options-label"></label>
120        <div class="col-sm-9 wt-page-options-value">
121            <input type="submit" class="btn btn-primary" value="<?=  /* I18N: A button label. */ I18N::translate('search') ?>">
122        </div>
123    </div>
124</form>
125
126<?php if ($firstname !== '' || $lastname !== '' || $place !== '') : ?>
127    <?php if ($individuals->isEmpty()) : ?>
128        <div class="alert alert-info row">
129            <?= I18N::translate('No results found.') ?>
130        </div>
131    <?php else : ?>
132        <?= view('search-results', ['individuals' => $individuals, 'search_families' => false, 'search_individuals' => true, 'search_notes' => false, 'search_sources' => false, 'search_repositories' => false, 'tree' => $tree]) ?>
133    <?php endif ?>
134<?php endif ?>
135
136<?= view('modals/on-screen-keyboard') ?>
137