xref: /webtrees/resources/views/search-general-page.phtml (revision 058ba7243339e0f2f5f84aa0f772e56ee5252797)
1<?php
2
3use Fisharebest\Webtrees\Family;
4use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralAction;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Individual;
7use Fisharebest\Webtrees\Location;
8use Fisharebest\Webtrees\Note;
9use Fisharebest\Webtrees\Repository;
10use Fisharebest\Webtrees\Source;
11use Fisharebest\Webtrees\Tree;
12use Illuminate\Support\Collection;
13
14/**
15 * @var Collection<Tree>       $all_trees
16 * @var bool                   $exist_locations
17 * @var bool                   $exist_notes
18 * @var bool                   $exist_repositories
19 * @var bool                   $exist_sources
20 * @var Collection<Family>     $families
21 * @var Collection<Individual> $individuals
22 * @var Collection<Location>   $locations
23 * @var Collection<Note>       $notes
24 * @var string                 $query
25 * @var Collection<Repository> $repositories
26 * @var Collection<Source>     $sources
27 * @var bool                   $search_families
28 * @var bool                   $search_individuals
29 * @var bool                   $search_locations
30 * @var bool                   $search_notes
31 * @var bool                   $search_repositories
32 * @var bool                   $search_sources
33 * @var Collection<Tree>       $search_trees
34 * @var string                 $title
35 * @var Tree                   $tree
36 */
37
38?>
39
40<h2 class="wt-page-title">
41    <?= $title ?>
42</h2>
43
44<form method="post" action="<?= e(route(SearchGeneralAction::class, ['tree' => $tree->name()])) ?>"
45      class="wt-page-options wt-page-options-search hidden-print mb-4" name="searchform">
46    <?= csrf_field() ?>
47    <div class="row form-group">
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    <fieldset class="form-group">
59        <div 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        </div>
121    </fieldset>
122
123    <?= view('search-trees', ['all_trees' => $all_trees, 'search_trees' => $search_trees]) ?>
124
125    <div class="row form-group">
126        <label class="col-sm-3 col-form-label wt-page-options-label"></label>
127        <div class="col-sm-9 wt-page-options-value">
128            <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */
129            I18N::translate('search') ?>">
130        </div>
131    </div>
132</form>
133
134<?php if ($query !== '') : ?>
135    <?php if ($individuals->isEmpty() && $families->isEmpty() && $locations->isEmpty() && $repositories->isEmpty() && $sources->isEmpty() && $notes->isEmpty()) : ?>
136        <div class="alert alert-info row">
137            <?= I18N::translate('No results found.') ?>
138        </div>
139    <?php else : ?>
140        <?= 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]) ?>
141    <?php endif ?>
142<?php endif ?>
143
144<?= view('modals/on-screen-keyboard') ?>
145