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