xref: /webtrees/resources/views/search-results.phtml (revision b11cdcd45131b1585d66693fab363cfeb18c51a4)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Family;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Individual;
8use Fisharebest\Webtrees\Location;
9use Fisharebest\Webtrees\Note;
10use Fisharebest\Webtrees\Repository;
11use Fisharebest\Webtrees\Source;
12use Fisharebest\Webtrees\Tree;
13use Fisharebest\Webtrees\View;
14use Illuminate\Support\Collection;
15
16/**
17 * @var Collection<int,Family>     $families
18 * @var Collection<int,Individual> $individuals
19 * @var Collection<int,Location>   $locations
20 * @var Collection<int,Note>       $notes
21 * @var Collection<int,Repository> $repositories
22 * @var Collection<int,Source>     $sources
23 * @var bool                       $search_families
24 * @var bool                       $search_individuals
25 * @var bool                       $search_locations
26 * @var bool                       $search_notes
27 * @var bool                       $search_repositories
28 * @var bool                       $search_sources
29 * @var Tree                       $tree
30 */
31
32?>
33
34<div class="wt-search-results">
35    <ul class="nav nav-tabs wt-search-results-tabs" role="tablist">
36        <?php if ($search_individuals) : ?>
37            <li class="nav-item" role="presentation">
38                <button class="nav-link <?= $individuals->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#individuals" data-bs-toggle="tab" href="#individuals" role="tab" aria-controls="individuals">
39                    <?= I18N::translate('Individuals') ?>
40                    <span class="badge bg-secondary">
41                        <?= I18N::number(count($individuals)) ?>
42                    </span>
43                </button>
44            </li>
45        <?php endif ?>
46
47        <?php if ($search_families) : ?>
48            <li class="nav-item" role="presentation">
49                <button class="nav-link <?= $families->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#families" data-bs-toggle="tab" href="#families" role="tab" aria-controls="families">
50                    <?= I18N::translate('Families') ?>
51                    <span class="badge bg-secondary">
52                        <?= I18N::number(count($families)) ?>
53                    </span>
54                </button>
55            </li>
56        <?php endif ?>
57
58        <?php if ($search_sources) : ?>
59            <li class="nav-item" role="presentation">
60                <button class="nav-link <?= $sources->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#sources" data-bs-toggle="tab" href="#sources" role="tab" aria-controls="sources">
61                    <?= I18N::translate('Sources') ?>
62                    <span class="badge bg-secondary">
63                        <?= I18N::number(count($sources)) ?>
64                    </span>
65                </button>
66            </li>
67        <?php endif ?>
68
69        <?php if ($search_repositories) : ?>
70            <li class="nav-item" role="presentation">
71                <button class="nav-link <?= $repositories->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#repositories" data-bs-toggle="tab" href="#repositories" role="tab" aria-controls="repositories">
72                    <?= I18N::translate('Repositories') ?>
73                    <span class="badge bg-secondary">
74                        <?= I18N::number(count($repositories)) ?>
75                    </span>
76                </button>
77            </li>
78        <?php endif ?>
79
80        <?php if ($search_notes) : ?>
81            <li class="nav-item" role="presentation">
82                <button class="nav-link <?= $notes->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#notes" data-bs-toggle="tab" href="#notes" role="tab" aria-controls="notes">
83                    <?= I18N::translate('Notes') ?>
84                    <span class="badge bg-secondary">
85                        <?= I18N::number(count($notes)) ?>
86                    </span>
87                </button>
88            </li>
89        <?php endif ?>
90
91        <?php if ($search_locations) : ?>
92            <li class="nav-item" role="presentation">
93                <button class="nav-link <?= $locations->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#locations" data-bs-toggle="tab" href="#locations" role="tab" aria-controls="locations">
94                    <?= I18N::translate('Locations') ?>
95                    <span class="badge bg-secondary">
96                        <?= I18N::number(count($locations)) ?>
97                    </span>
98                </button>
99            </li>
100        <?php endif ?>
101    </ul>
102
103    <div class="tab-content wt-search-results-content">
104        <?php if ($search_individuals) : ?>
105            <div class="tab-pane" id="individuals" role="tabpanel" aria-labelledby="individuals-tab">
106                <?= view('lists/individuals-table', ['individuals' => $individuals, 'sosa' => false, 'tree' => $tree]) ?>
107            </div>
108        <?php endif ?>
109
110        <?php if ($search_families) : ?>
111            <div class="tab-pane" id="families" role="tabpanel" aria-labelledby="families-tab">
112                <?= view('lists/families-table', ['families' => $families, 'tree' => $tree]) ?>
113            </div>
114        <?php endif ?>
115
116        <?php if ($search_sources) : ?>
117            <div class="tab-pane" id="sources" role="tabpanel" aria-labelledby="sources-tab">
118                <?= view('lists/sources-table', ['sources' => $sources, 'tree' => $tree]) ?>
119            </div>
120        <?php endif ?>
121
122        <?php if ($search_repositories) : ?>
123            <div class="tab-pane" id="repositories" role="tabpanel" aria-labelledby="repositories-tab">
124                <?= view('lists/repositories-table', ['repositories' => $repositories, 'tree' => $tree]) ?>
125            </div>
126        <?php endif ?>
127
128        <?php if ($search_notes) : ?>
129            <div class="tab-pane" id="notes" role="tabpanel" aria-labelledby="notes-tab">
130                <?= view('lists/notes-table', ['notes' => $notes, 'tree' => $tree]) ?>
131            </div>
132        <?php endif ?>
133
134        <?php if ($search_locations) : ?>
135            <div class="tab-pane" id="locations" role="tabpanel" aria-labelledby="locations-tab">
136                <?= view('lists/locations-table', ['locations' => $locations, 'tree' => $tree]) ?>
137            </div>
138        <?php endif ?>
139    </div>
140</div>
141
142<?php View::push('javascript') ?>
143<script>
144  document.querySelector('.wt-search-results-tabs li button').click();
145</script>
146<?php View::endpush() ?>
147