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