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