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