summaryrefslogtreecommitdiff
path: root/resources/views/search-general-page.phtml
blob: b841a76515ba6a6bd76f5a25f1172966ee5aac8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php

use Fisharebest\Webtrees\Family;
use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Location;
use Fisharebest\Webtrees\Note;
use Fisharebest\Webtrees\Repository;
use Fisharebest\Webtrees\Source;
use Fisharebest\Webtrees\Tree;
use Illuminate\Support\Collection;

/**
 * @var Collection<Tree>       $all_trees
 * @var bool                   $exist_locations
 * @var bool                   $exist_notes
 * @var bool                   $exist_repositories
 * @var bool                   $exist_sources
 * @var Collection<Family>     $families
 * @var Collection<Individual> $individuals
 * @var Collection<Location>   $locations
 * @var Collection<Note>       $notes
 * @var string                 $query
 * @var Collection<Repository> $repositories
 * @var Collection<Source>     $sources
 * @var bool                   $search_families
 * @var bool                   $search_individuals
 * @var bool                   $search_locations
 * @var bool                   $search_notes
 * @var bool                   $search_repositories
 * @var bool                   $search_sources
 * @var Collection<Tree>       $search_trees
 * @var string                 $title
 * @var Tree                   $tree
 */

?>

<h2 class="wt-page-title">
    <?= $title ?>
</h2>

<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">
    <?= csrf_field() ?>
    <div class="row form-group mb-3">
        <label class="col-sm-3 col-form-label wt-page-options-label" for="query">
            <?= I18N::translate('Search for') ?>
        </label>
        <div class="col-sm-9 wt-page-options-value">
            <div class="input-group">
                <input id="query" class="form-control" type="text" name="query" value="<?= e($query) ?>" required="required">
                <?= view('edit/input-addon-keyboard', ['id' => 'query']) ?>
            </div>
        </div>
    </div>

    <fieldset class="row form-group mb-3">
        <label class="col-sm-3 col-form-label wt-page-options-label">
            <?= I18N::translate('Records') ?>
        </label>
        <div class="col-sm-9 wt-page-options-value">
            <div class="form-check form-check-inline">
                <label class="form-check-label">
                    <input class="form-check-input" <?= $search_individuals ? 'checked' : '' ?>
                           name="search_individuals" type="checkbox">
                    <?= I18N::translate('Individuals') ?>
                </label>
            </div>

            <div class="form-check form-check-inline">
                <label class="form-check-label">
                    <input class="form-check-input" <?= $search_families ? 'checked' : '' ?> name="search_families"
                           type="checkbox">
                    <?= I18N::translate('Families') ?>
                </label>
            </div>

            <?php if ($exist_sources) : ?>
                <div class="form-check form-check-inline">
                    <label class="form-check-label">
                        <input class="form-check-input" <?= $search_sources ? 'checked' : '' ?> name="search_sources"
                               type="checkbox">
                        <?= I18N::translate('Sources') ?>
                    </label>
                </div>
            <?php endif ?>

            <?php if ($exist_repositories) : ?>
                <div class="form-check form-check-inline">
                    <label class="form-check-label">
                        <input class="form-check-input" <?= $search_repositories ? 'checked' : '' ?>
                               name="search_repositories" type="checkbox">
                        <?= I18N::translate('Repositories') ?>
                    </label>
                </div>
            <?php endif ?>

            <?php if ($exist_notes) : ?>
                <div class="form-check form-check-inline">
                    <label class="form-check-label">
                        <input class="form-check-input" <?= $search_notes ? 'checked' : '' ?> name="search_notes"
                               type="checkbox">
                        <?= I18N::translate('Shared notes') ?>
                    </label>
                </div>
            <?php endif ?>

            <?php if ($exist_locations) : ?>
                <div class="form-check form-check-inline">
                    <label class="form-check-label">
                        <input class="form-check-input" <?= $search_locations ? 'checked' : '' ?> name="search_locations"
                               type="checkbox">
                        <?= I18N::translate('Locations') ?>
                    </label>
                </div>
            <?php endif ?>
        </div>
    </fieldset>

    <?= view('search-trees', ['all_trees' => $all_trees, 'search_trees' => $search_trees]) ?>

    <div class="row form-group mb-3">
        <label class="col-sm-3 col-form-label wt-page-options-label"></label>
        <div class="col-sm-9 wt-page-options-value">
            <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */
            I18N::translate('search') ?>">
        </div>
    </div>
</form>

<?php if ($query !== '') : ?>
    <?php if ($individuals->isEmpty() && $families->isEmpty() && $locations->isEmpty() && $repositories->isEmpty() && $sources->isEmpty() && $notes->isEmpty()) : ?>
        <div class="alert alert-info">
            <?= I18N::translate('No results found.') ?>
        </div>
    <?php else : ?>
        <?= 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]) ?>
    <?php endif ?>
<?php endif ?>

<?= view('modals/on-screen-keyboard') ?>