xref: /webtrees/resources/views/search-general-page.phtml (revision ac71572d8462e396ed5a307f05b29381e49f9e6e)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Family;
6use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralAction;
7use Fisharebest\Webtrees\I18N;
8use Fisharebest\Webtrees\Individual;
9use Fisharebest\Webtrees\Location;
10use Fisharebest\Webtrees\Note;
11use Fisharebest\Webtrees\Repository;
12use Fisharebest\Webtrees\Source;
13use Fisharebest\Webtrees\Tree;
14use Illuminate\Support\Collection;
15
16/**
17 * @var Collection<int,Tree>       $all_trees
18 * @var bool                       $exist_locations
19 * @var bool                       $exist_notes
20 * @var bool                       $exist_repositories
21 * @var bool                       $exist_sources
22 * @var Collection<int,Family>     $families
23 * @var Collection<int,Individual> $individuals
24 * @var Collection<int,Location>   $locations
25 * @var Collection<int,Note>       $notes
26 * @var string                     $query
27 * @var Collection<int,Repository> $repositories
28 * @var Collection<int,Source>     $sources
29 * @var bool                       $search_families
30 * @var bool                       $search_individuals
31 * @var bool                       $search_locations
32 * @var bool                       $search_notes
33 * @var bool                       $search_repositories
34 * @var bool                       $search_sources
35 * @var Collection<int,Tree>       $search_trees
36 * @var string                     $title
37 * @var Tree                       $tree
38 */
39
40?>
41
42<h2 class="wt-page-title">
43    <?= $title ?>
44</h2>
45
46<form method="post" action="<?= e(route(SearchGeneralAction::class, ['tree' => $tree->name()])) ?>" class="wt-page-options wt-page-options-search hidden-print mb-4" name="searchform">
47    <div class="row">
48        <label class="col-sm-3 col-form-label wt-page-options-label" for="query">
49            <?= I18N::translate('Search for') ?>
50        </label>
51        <div class="col-sm-9 wt-page-options-value">
52            <div class="input-group">
53                <input id="query" class="form-control" type="text" name="query" value="<?= e($query) ?>" required="required">
54                <?= view('edit/input-addon-keyboard', ['id' => 'query']) ?>
55            </div>
56        </div>
57    </div>
58
59    <fieldset class="row">
60        <label class="col-sm-3 col-form-label wt-page-options-label">
61            <?= I18N::translate('Records') ?>
62        </label>
63        <div class="col-sm-9 wt-page-options-value">
64            <div class="form-check form-check-inline">
65                <label class="form-check-label">
66                    <input class="form-check-input" <?= $search_individuals ? 'checked' : '' ?>
67                           name="search_individuals" type="checkbox">
68                    <?= I18N::translate('Individuals') ?>
69                </label>
70            </div>
71
72            <div class="form-check form-check-inline">
73                <label class="form-check-label">
74                    <input class="form-check-input" <?= $search_families ? 'checked' : '' ?> name="search_families"
75                           type="checkbox">
76                    <?= I18N::translate('Families') ?>
77                </label>
78            </div>
79
80            <?php if ($exist_sources) : ?>
81                <div class="form-check form-check-inline">
82                    <label class="form-check-label">
83                        <input class="form-check-input" <?= $search_sources ? 'checked' : '' ?> name="search_sources"
84                               type="checkbox">
85                        <?= I18N::translate('Sources') ?>
86                    </label>
87                </div>
88            <?php endif ?>
89
90            <?php if ($exist_repositories) : ?>
91                <div class="form-check form-check-inline">
92                    <label class="form-check-label">
93                        <input class="form-check-input" <?= $search_repositories ? 'checked' : '' ?>
94                               name="search_repositories" type="checkbox">
95                        <?= I18N::translate('Repositories') ?>
96                    </label>
97                </div>
98            <?php endif ?>
99
100            <?php if ($exist_notes) : ?>
101                <div class="form-check form-check-inline">
102                    <label class="form-check-label">
103                        <input class="form-check-input" <?= $search_notes ? 'checked' : '' ?> name="search_notes"
104                               type="checkbox">
105                        <?= I18N::translate('Shared notes') ?>
106                    </label>
107                </div>
108            <?php endif ?>
109
110            <?php if ($exist_locations) : ?>
111                <div class="form-check form-check-inline">
112                    <label class="form-check-label">
113                        <input class="form-check-input" <?= $search_locations ? 'checked' : '' ?> name="search_locations"
114                               type="checkbox">
115                        <?= I18N::translate('Locations') ?>
116                    </label>
117                </div>
118            <?php endif ?>
119        </div>
120    </fieldset>
121
122    <?= view('search-trees', ['all_trees' => $all_trees, 'search_trees' => $search_trees]) ?>
123
124    <div class="row">
125        <label class="col-sm-3 col-form-label wt-page-options-label"></label>
126        <div class="col-sm-9 wt-page-options-value">
127            <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */
128            I18N::translate('search') ?>">
129        </div>
130    </div>
131
132    <?= csrf_field() ?>
133</form>
134
135<?php if ($query !== '') : ?>
136    <?php if ($individuals->isEmpty() && $families->isEmpty() && $locations->isEmpty() && $repositories->isEmpty() && $sources->isEmpty() && $notes->isEmpty()) : ?>
137        <div class="alert alert-info">
138            <?= I18N::translate('No results found.') ?>
139        </div>
140    <?php else : ?>
141        <?= view('search-results', ['families' => $families, 'individuals' => $individuals, 'locations' => $locations, 'notes' => $notes, 'repositories' => $repositories, 'sources' => $sources, 'search_families' => $search_families, 'search_individuals' => $search_individuals, 'search_locations' => $search_locations, 'search_notes' => $search_notes, 'search_repositories' => $search_repositories, 'search_sources' => $search_sources, 'tree' => $tree]) ?>
142    <?php endif ?>
143<?php endif ?>
144
145<?= view('modals/on-screen-keyboard') ?>
146