xref: /webtrees/resources/views/search-general-page.phtml (revision 81443e3cbe4eef5ccdcf8dae716a7e35f7417b60)
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<int,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<int,Family>     $families
21 * @var Collection<int,Individual> $individuals
22 * @var Collection<int,Location>   $locations
23 * @var Collection<int,Note>       $notes
24 * @var string                     $query
25 * @var Collection<int,Repository> $repositories
26 * @var Collection<int,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<int,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()])) ?>" class="wt-page-options wt-page-options-search hidden-print mb-4" name="searchform">
45    <div class="row">
46        <label class="col-sm-3 col-form-label wt-page-options-label" for="query">
47            <?= I18N::translate('Search for') ?>
48        </label>
49        <div class="col-sm-9 wt-page-options-value">
50            <div class="input-group">
51                <input id="query" class="form-control" type="text" name="query" value="<?= e($query) ?>" required="required">
52                <?= view('edit/input-addon-keyboard', ['id' => 'query']) ?>
53            </div>
54        </div>
55    </div>
56
57    <fieldset class="row">
58        <label class="col-sm-3 col-form-label wt-page-options-label">
59            <?= I18N::translate('Records') ?>
60        </label>
61        <div class="col-sm-9 wt-page-options-value">
62            <div class="form-check form-check-inline">
63                <label class="form-check-label">
64                    <input class="form-check-input" <?= $search_individuals ? 'checked' : '' ?>
65                           name="search_individuals" type="checkbox">
66                    <?= I18N::translate('Individuals') ?>
67                </label>
68            </div>
69
70            <div class="form-check form-check-inline">
71                <label class="form-check-label">
72                    <input class="form-check-input" <?= $search_families ? 'checked' : '' ?> name="search_families"
73                           type="checkbox">
74                    <?= I18N::translate('Families') ?>
75                </label>
76            </div>
77
78            <?php if ($exist_sources) : ?>
79                <div class="form-check form-check-inline">
80                    <label class="form-check-label">
81                        <input class="form-check-input" <?= $search_sources ? 'checked' : '' ?> name="search_sources"
82                               type="checkbox">
83                        <?= I18N::translate('Sources') ?>
84                    </label>
85                </div>
86            <?php endif ?>
87
88            <?php if ($exist_repositories) : ?>
89                <div class="form-check form-check-inline">
90                    <label class="form-check-label">
91                        <input class="form-check-input" <?= $search_repositories ? 'checked' : '' ?>
92                               name="search_repositories" type="checkbox">
93                        <?= I18N::translate('Repositories') ?>
94                    </label>
95                </div>
96            <?php endif ?>
97
98            <?php if ($exist_notes) : ?>
99                <div class="form-check form-check-inline">
100                    <label class="form-check-label">
101                        <input class="form-check-input" <?= $search_notes ? 'checked' : '' ?> name="search_notes"
102                               type="checkbox">
103                        <?= I18N::translate('Shared notes') ?>
104                    </label>
105                </div>
106            <?php endif ?>
107
108            <?php if ($exist_locations) : ?>
109                <div class="form-check form-check-inline">
110                    <label class="form-check-label">
111                        <input class="form-check-input" <?= $search_locations ? 'checked' : '' ?> name="search_locations"
112                               type="checkbox">
113                        <?= I18N::translate('Locations') ?>
114                    </label>
115                </div>
116            <?php endif ?>
117        </div>
118    </fieldset>
119
120    <?= view('search-trees', ['all_trees' => $all_trees, 'search_trees' => $search_trees]) ?>
121
122    <div class="row">
123        <label class="col-sm-3 col-form-label wt-page-options-label"></label>
124        <div class="col-sm-9 wt-page-options-value">
125            <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */
126            I18N::translate('search') ?>">
127        </div>
128    </div>
129
130    <?= csrf_field() ?>
131</form>
132
133<?php if ($query !== '') : ?>
134    <?php if ($individuals->isEmpty() && $families->isEmpty() && $locations->isEmpty() && $repositories->isEmpty() && $sources->isEmpty() && $notes->isEmpty()) : ?>
135        <div class="alert alert-info">
136            <?= I18N::translate('No results found.') ?>
137        </div>
138    <?php else : ?>
139        <?= 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]) ?>
140    <?php endif ?>
141<?php endif ?>
142
143<?= view('modals/on-screen-keyboard') ?>
144